xeniux

Untitled

Jul 6th, 2025
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.83 KB | None | 0 0
  1. dofile("scripts\\donation_interactive.lua")
  2. function init (obj)
  3. xr_motivator.AddToMotivator(obj)
  4. end
  5.  
  6. function actor_init (npc)
  7. npc:bind_object(actor_binder(npc))
  8. end
  9. local sim = alife()
  10.  
  11. local game_difficulty_by_num = {
  12. [0] = "gd_novice",
  13. [1] = "gd_stalker",
  14. [2] = "gd_veteran",
  15. [3] = "gd_master"
  16. }
  17.  
  18. lasthealth = 0
  19. lasttime = 0
  20. post_process = 0
  21. local weapon_hide = false
  22. ----------------------------------------------------------------------------------------------------------------------
  23. class "actor_binder" (object_binder)
  24. ----------------------------------------------------------------------------------------------------------------------
  25. function actor_binder:__init (obj) super(obj)
  26. self.am = ogse_signals.get_mgr()
  27. self.am:call( "on_load_before_all" )
  28. self.am:call( "on_init", obj )
  29. self.bCheckStart = false
  30. self.weather_manager = level_weathers.WeatherManager()
  31. self.actor_detector = xr_detector.actor_detector()
  32. end
  33.  
  34. function actor_binder:__finalize()
  35. self.am:call( "on_finalize" )
  36. xr_s.init()
  37. end
  38. ----------------------------------------------------------------------------------------------------------------------
  39. function actor_binder:net_spawn(data)
  40. printf("actor net spawn")
  41.  
  42. level.show_indicators()
  43.  
  44. self.bCheckStart = true
  45. self.weapon_hide = false -- ???? ?? ?? ??? ?? ?????.
  46. weapon_hide = false -- ??????? ?????? ?????? ??.
  47.  
  48. if object_binder.net_spawn(self,data) == false then
  49. return false
  50. end
  51.  
  52. db.add_actor(self.object)
  53.  
  54. if self.st.disable_input_time == nil then
  55. level.enable_input()
  56. end
  57.  
  58. self.weather_manager:reset()
  59. -- game_stats.initialize ()
  60.  
  61. if(actor_stats.add_to_ranking~=nil)then
  62. actor_stats.add_to_ranking(self.object:id())
  63. end
  64.  
  65.  
  66.  
  67. --' ????? ????? ???
  68. death_manager.init_drop_settings()
  69.  
  70. self.am:call("on_spawn", data)
  71.  
  72. return true
  73. end
  74. ----------------------------------------------------------------------------------------------------------------------
  75. function actor_binder:net_destroy()
  76. if(actor_stats.remove_from_ranking~=nil)then
  77. actor_stats.remove_from_ranking(self.object:id())
  78. end
  79. -- game_stats.shutdown ()
  80. db.del_actor(self.object)
  81.  
  82. sr_light.clean_up ()
  83.  
  84. self.object:set_callback(callback.inventory_info, nil)
  85. self.object:set_callback(callback.article_info, nil)
  86. self.object:set_callback(callback.on_item_take, nil)
  87. self.object:set_callback(callback.on_item_drop, nil)
  88. --self.object:set_callback(callback.actor_sleep, nil)
  89. self.object:set_callback(callback.task_state, nil)
  90. self.object:set_callback(callback.level_border_enter, nil)
  91. self.object:set_callback(callback.level_border_exit, nil)
  92. self.object:set_callback(callback.take_item_from_box, nil)
  93.  
  94. self.object:set_callback( callback.on_before_use_item, nil )
  95. self.object:set_callback(callback.use_object, nil)
  96. self.object:set_callback(callback.on_belt, nil)
  97. self.object:set_callback( callback.on_ruck, nil )
  98. self.object:set_callback( callback.on_slot, nil )
  99.  
  100. self.object:set_callback( callback.on_key_press, nil )
  101. self.object:set_callback( callback.on_key_release, nil )
  102. self.object:set_callback( callback.on_key_hold, nil )
  103.  
  104. self.object:set_callback( callback.on_mouse_wheel, nil )
  105. self.object:set_callback( callback.on_mouse_move, nil )
  106. self.object:set_callback( callback.on_cell_item_focus, nil )
  107. self.object:set_callback( callback.on_cell_item_focus_lost, nil )
  108. self.object:set_callback( callback.on_cell_item_mouse, nil )
  109. self.object:set_callback(callback.hit, nil)
  110. self.object:set_callback(callback.entity_alive_before_hit, nil)
  111. self.object:set_callback(callback.on_actor_step, nil)
  112. self.object:set_callback(callback.death, nil)
  113. self.object:set_callback(callback.level_changer_action, nil)
  114. self.object:set_callback(callback.on_actor_quickknifehit, nil)
  115. self.object:set_callback(callback.on_actor_anim_pnv_on, nil)
  116.  
  117.  
  118. self.object:set_callback(callback.update_artefacts_on_belt, nil)
  119.  
  120. self.object:set_callback(callback.on_actor_firemode, nil)
  121. self.object:set_callback(callback.weapon_fired, nil)
  122.  
  123. self.object:set_callback(callback.on_actor_wpndraw, nil)
  124. self.object:set_callback(callback.on_actor_wpnholster, nil)
  125.  
  126. self.object:set_callback(callback.on_actor_jump, nil)
  127. self.object:set_callback(callback.on_actor_land, nil)
  128.  
  129. self.object:set_callback(callback.on_actor_weapon_zoom_in, nil)
  130. self.object:set_callback(callback.on_actor_weapon_zoom_out, nil)
  131. if sr_psy_antenna.psy_antenna then
  132. sr_psy_antenna.psy_antenna:destroy()
  133. sr_psy_antenna.psy_antenna = false
  134. end
  135.  
  136. xr_sound.stop_all_sound_object()
  137.  
  138. self.am:call("on_destroy")
  139.  
  140. object_binder.net_destroy(self)
  141. end
  142. ----------------------------------------------------------------------------------------------------------------------
  143. function actor_binder:reinit()
  144. object_binder.reinit(self)
  145.  
  146. local npc_id = self.object:id()
  147.  
  148. db.storage[npc_id] = { }
  149.  
  150. self.st = db.storage[npc_id]
  151. self.st.pstor = nil
  152.  
  153. self.next_restrictors_update_time = -10000
  154.  
  155. self.object:set_callback(callback.inventory_info, self.info_callback, self)
  156. self.object:set_callback(callback.article_info, self.article_callback, self)
  157. self.object:set_callback(callback.on_item_take, self.on_item_take, self)
  158. self.object:set_callback(callback.on_item_drop, self.on_item_drop, self)
  159. self.object:set_callback(callback.trade_sell_buy_item, self.on_trade, self) -- for game stats
  160. self.object:set_callback(callback.task_state, self.task_callback, self)
  161. self.object:set_callback(callback.level_border_enter, self.level_border_enter, self)
  162. self.object:set_callback(callback.level_border_exit, self.level_border_exit, self)
  163. self.object:set_callback(callback.take_item_from_box, self.take_item_from_box, self)
  164. self.object:set_callback(callback.use_object, self.use_object, self)
  165. self.object:set_callback( callback.on_before_use_item, self.before_use, self )
  166. self.object:set_callback(callback.on_belt, self.item_to_belt, self)
  167. self.object:set_callback( callback.on_ruck, self.item_to_backpack, self )
  168.  
  169. self.object:set_callback( callback.on_slot, self.item_to_slot, self )
  170. self.object:set_callback( callback.on_key_press, self.on_key, self )
  171. self.object:set_callback( callback.on_key_release, self.on_key_free, self )
  172. self.object:set_callback( callback.on_key_hold, self.on_key_hold, self )
  173.  
  174.  
  175. self.object:set_callback( callback.on_mouse_wheel, self.on_wheel_rotation, self )
  176. self.object:set_callback( callback.on_mouse_move, self.on_mouse_move, self )
  177. self.object:set_callback( callback.on_cell_item_focus, self.on_cell_item_focus, self )
  178. self.object:set_callback( callback.on_cell_item_focus_lost, self.on_cell_item_focus_lost, self )
  179. self.object:set_callback( callback.on_cell_item_mouse, self.on_cell_item_mouse, self )
  180.  
  181. self.object:set_callback(callback.hit, self.actor_hit_callback, self)
  182. self.object:set_callback(callback.entity_alive_before_hit, self.before_hit_callback, self)
  183. self.object:set_callback(callback.death, self.actor_death_callback, self)
  184. self.object:set_callback(callback.on_actor_step, self.on_actor_step_callback, self)
  185. self.object:set_callback(callback.level_changer_action, self.level_changer_action, self)
  186.  
  187. self.object:set_callback( callback.on_actor_quickknifehit, self.quickknifehit, self )
  188. self.object:set_callback( callback.on_actor_anim_pnv_on, self.actor_anim_pnv_on, self )
  189.  
  190. self.object:set_callback( callback.on_actor_firemode, self.on_actor_firemode_change, self )
  191.  
  192. self.object:set_callback(callback.update_artefacts_on_belt, self.update_artefacts_on_belt, self)
  193.  
  194. self.object:set_callback(callback.weapon_fired, self.on_weapon_fired, self)
  195. self.object:set_callback(callback.on_actor_wpndraw, self.actor_wpndraw, self)
  196. self.object:set_callback(callback.on_actor_wpnholster, self.actor_wpnholster, self)
  197.  
  198. self.object:set_callback(callback.on_actor_jump, self.actor_jump, self)
  199. self.object:set_callback(callback.on_actor_land, self.actor_land, self)
  200.  
  201. self.object:set_callback(callback.on_actor_weapon_zoom_in, self.on_actor_weapon_zoom_in, self)
  202. self.object:set_callback(callback.on_actor_weapon_zoom_out, self.on_actor_weapon_zoom_out, self)
  203.  
  204. self.am:call("on_reinit")
  205.  
  206. end
  207.  
  208. function actor_binder:actor_jump()
  209. end
  210.  
  211. function actor_binder:actor_land()
  212. local rand = math.random(1,2)
  213. level.add_cam_effector("camera_effects\\landing_crp" .. rand .. ".anm", 1905, false, "")
  214. local land_snd = xr_sound.get_safe_sound_object("actor\\jump_sounds\\land_default")
  215. land_snd:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 0.6)
  216. end
  217.  
  218. local snd_using
  219. function actor_binder:actor_wpndraw()
  220. dsh.timeout( 100, function()
  221. local act_it = db.actor:active_item()
  222. if act_it then
  223. local snd2 = get_string( act_it:section(), "snd_draw" )
  224. snd_using = sound_object(snd2)
  225. if not snd_using:playing() then
  226. snd_using:play( db.actor, 0, sound_object.s2d )
  227. end
  228. end
  229. end )
  230. end
  231.  
  232. function actor_binder:actor_wpnholster()
  233. dsh.timeout( 100, function()
  234. local act_it = db.actor:active_item()
  235. if act_it then
  236. local snd2 = get_string( act_it:section(), "snd_holster" )
  237. snd_using = sound_object(snd2)
  238. if not snd_using:playing() then
  239. snd_using:play( db.actor, 0, sound_object.s2d )
  240. end
  241. end
  242. end )
  243. end
  244.  
  245. function actor_binder:before_hit_callback(hit_data)
  246.  
  247. self.am:call("on_actor_before_hit", hit_data)
  248.  
  249. local obj = hit_data.who
  250. if obj then
  251. local hit_type = hit_data.hit_type
  252. if hit_type == hit.telepatic then
  253. if hit_data.who_id == db.actor:id() then
  254. local cdir = device().cam_dir
  255. local angle_down = cdir.y
  256. log1(angle_down)
  257. if angle_down <= -0.95 or angle_down >= 0.95 then
  258. return
  259. else
  260. local flash_snd = xr_sound.get_safe_sound_object([[weapons\zarya2_flash]])
  261. flash_snd:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 1.0)
  262. level.add_pp_effector ("teleport.ppe", 2009, false)
  263. end
  264. end
  265. elseif hit_type == hit.burn then
  266. if db.actor:dont_has_info( "actor_burning" ) then
  267. db.actor:give_info_portion("actor_burning")
  268. end
  269. end
  270. end
  271.  
  272. end
  273.  
  274. function actor_binder:on_actor_firemode_change( obj )
  275. local act_it = db.actor:active_item()
  276. if act_it and db.actor:zoom_mode() then
  277. local firemode = get_float( act_it:section(), "firemod_status" )
  278. if firemode and firemode == 1 then
  279. anm_name2 = "camera_effects\\weapon\\l85_gloff_firemode_a_to_1.anm"
  280. game.play_hud_anm(anm_name2, 2, 1, 1, false)
  281. level.add_cam_effector("camera_effects\\weapon\\l85_gloff_firemode_a_to_1.anm", 1902, false, "")
  282. end
  283. end
  284. end
  285.  
  286. function actor_binder:on_weapon_fired()
  287. ogse_body_states.on_weapon_fired()
  288. ogse_body_states.actor_on_weapon_fire()
  289. end
  290.  
  291. function actor_binder:update_artefacts_on_belt(dt)
  292. self.am:call("update_artefacts_on_belt", dt)
  293. end
  294.  
  295. function actor_binder:quickknifehit( obj )
  296. start_real_timer("kick_hit", 150, "gunsl_hud_animations_mgr.get_hud_animations_mgr():kick_hit_melee")
  297. end
  298.  
  299. function actor_binder:actor_anim_pnv_on( obj )
  300. start_real_timer("on_off_pnv", 400, "ogse_night_vision.on_off_pnv")
  301. local snd_nv = sound_object('weapons\\nv_deact')
  302. snd_nv:play(db.actor, 0, sound_object.s2d)
  303. end
  304.  
  305. function actor_binder:on_actor_step_callback( obj, material, power )
  306. ogse_body_states.actor_on_exo_footstep(obj, material, power)
  307.  
  308. end
  309.  
  310. function actor_binder:actor_death_callback(victim, who)
  311. gunsl_3dscopes_backlight.on_zoom_out_night()
  312. local hud = get_hud()
  313. if hud:GetCustomStatic("gunsl_nv_screen_mask")~=nil then
  314. hud:RemoveCustomStatic("gunsl_nv_screen_mask")
  315. end
  316. level.add_cam_effector("camera_effects\\surge_02.anm", 2532, false, "")
  317. level.add_pp_effector("surge_fade.ppe", 2011, true)
  318. start_real_timer("death_wake", 1300, "bind_stalker.death_wake")
  319. level.disable_input()
  320. end
  321.  
  322. function death_wake()
  323. level.add_pp_effector("deadcity_wake.ppe", 4467, true)
  324. end
  325.  
  326. function actor_binder:on_wheel_rotation( vol )
  327. xr_s.on_event("mouse_wheel", vol)
  328. end
  329.  
  330. function actor_binder:on_mouse_move( velx, vely )
  331. end
  332.  
  333. function actor_binder:on_cell_item_focus( obj )
  334. xr_s.on_event("cell_item_focus", obj)
  335. gunsl_drag_drop.on_cell_item_focus( obj )
  336. end
  337.  
  338.  
  339. function actor_binder:on_cell_item_focus_lost( obj )
  340. xr_s.on_event("cell_item_focus_lost", obj)
  341. gunsl_drag_drop.on_cell_item_focus_lost( obj )
  342. end
  343.  
  344.  
  345. function actor_binder:on_cell_item_mouse( obj, x, y, action )
  346. gunsl_drag_drop.on_cell_item_mouse( obj, x, y, action )
  347. end
  348.  
  349. function actor_binder:level_changer_action( obj, wnd )
  350. local sobj = obj:get_alife_object()
  351. local lc = sobj:get_level_changer()
  352. local dest_vertex = lc.dest_game_vertex_id
  353. local dest_lname = alife():level_name(
  354. game_graph():vertex( dest_vertex ):level_id()
  355. )
  356. if db.actor:has_info( "ui_inventory" ) then
  357. level.start_stop_menu( level.main_input_receiver(), true )
  358. end
  359.  
  360. local msg_text_wnd = wnd:FindChild( "message_box_change_level:button_yes" )
  361. if db.actor:has_info( "anim_action" ) then
  362. level.only_allow_movekeys(false)
  363. msg_text_wnd:GetCUIStatic():SetWndRect( Frect():set( -1000, 365, 117, 29 ) )
  364. else
  365. msg_text_wnd:GetCUIStatic():SetWndRect( Frect():set( 250, 154, 367, 183 ) )
  366. end
  367. end
  368.  
  369. function actor_binder:actor_hit_callback(obj, amount, local_direction, who, bone_index)
  370.  
  371. if who and who:id()~=db.actor:id() and amount > 0 then
  372. ogse_critical_hit.check_critical(amount, bone_index, who)
  373. ogse_critical_hit.helmet_damage(amount, bone_index, who)
  374. if IsMonster(who) then
  375. local mob_id = class_id or get_clsid (who)
  376. if ( mob_id == clsid.boar_s) or ( mob_id == clsid.chimera_s) or ( mob_id == clsid.bloodsucker_s) or ( mob_id == clsid.snork_s) then
  377. if amount > 0.20 then
  378. if db.actor:see(who) then
  379. bind_monster.boar_strike()
  380. end
  381. end
  382. end
  383. end
  384. if IsAnomaly(who) then
  385. local sect = who:section()
  386. if string.find(sect, "zharka") then
  387. if db.actor:dont_has_info( "actor_burning" ) then
  388. db.actor:give_info_portion("actor_burning")
  389. end
  390. end
  391. end
  392. end
  393.  
  394. end
  395. ----------------------------------------------------------------------------------------------------------------------
  396. function actor_binder:on_actor_weapon_zoom_in( obj )
  397.  
  398. local wpni = db.actor:active_item()
  399. if wpni then
  400. if ogse_wpn_utils.get_zoom_anm_status( wpni ) == 1 then
  401. local anm_name = "aim_in.anm"
  402. game.play_hud_anm(anm_name, 2, 1.0, 1, false)
  403. local snd = get_string(wpni:section(), "snd_aim_start")
  404. local snd_obj = sound_object(snd)
  405. if not snd_obj:playing() then
  406. snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 0.3)
  407. end
  408.  
  409.  
  410. end
  411. end
  412.  
  413.  
  414.  
  415.  
  416. if not get_console():get_bool("g_3d_scopes") then
  417. if db.actor:active_item():get_weapon():UseScopeTexture() then
  418. gunsl_hud_indicators.remove_indiks()
  419. ogse_quick_slots.RemoveFastUseSlotsHud()
  420. end
  421. end
  422. end
  423.  
  424. function actor_binder:on_actor_weapon_zoom_out( obj )
  425.  
  426.  
  427. local wpni = db.actor:active_item()
  428. if wpni then
  429. if ogse_wpn_utils.get_zoom_anm_status( wpni ) == 1 then
  430. local anm_name = "aim_out.anm"
  431. game.play_hud_anm(anm_name, 2, 1.0, 1, false)
  432. local snd = get_string(wpni:section(), "snd_aim_end")
  433. local snd_obj = sound_object(snd)
  434. if not snd_obj:playing() then
  435. snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 0.3)
  436. end
  437. end
  438. end
  439.  
  440.  
  441. if not get_console():get_bool("g_3d_scopes") then
  442. if db.actor:active_item():get_weapon():UseScopeTexture() then
  443. gunsl_hud_indicators.show_indicators()
  444. ogse_quick_slots.FastUseSlotsHud()
  445. end
  446. end
  447. end
  448.  
  449.  
  450. local keyboard_events = {
  451. [ "on_key_down" ] = "on_key_down",
  452. [ "on_key_hold" ] = "on_key_hold",
  453. [ "on_key_up" ] = "on_key_up",
  454. }
  455.  
  456. local kShifts = { [DIK_keys.DIK_RSHIFT] = true, [DIK_keys.DIK_LSHIFT] = true }
  457.  
  458. function actor_binder:on_key(key, bind)
  459. self.am:call("on_key_down", key, bind)
  460.  
  461. xr_s.on_event( "key_press", key, bind )
  462. gunsl_hud_animations_mgr.get_hud_animations_mgr():on_keyboard(key, bind)
  463.  
  464. end
  465.  
  466. function actor_binder:on_key_free(key, bind)
  467. self.am:call("on_key_up", key, bind)
  468. end
  469.  
  470. function actor_binder:on_key_hold(key, bind)
  471. end
  472.  
  473.  
  474.  
  475. function actor_binder:take_item_from_box(box, item)
  476. local story_id = box:story_id()
  477. if story_id == nil then
  478. return
  479. end
  480.  
  481. treasure_manager.take_item_from_box(box, story_id)
  482. --[[
  483. local respawner = se_respawn.get_respawner_by_parent(story_id)
  484. if respawner == nil then
  485. return
  486. end
  487.  
  488. --' ?????? ?????? ???? ? ?????
  489. respawner:remove_spawned(item:id())
  490.  
  491. local smart_terrain = db.strn_by_respawn[respawner:name()]
  492. if smart_terrain == nil then
  493. return
  494. end
  495.  
  496. local npc = smart_terrain.gulag:get_nearest_online_obj(db.actor:position())
  497. if npc ~= nil then
  498. xr_sound.set_sound_play(npc, "reac_box")
  499. xr_gulag.setGulagEnemy(smart_terrain:name() , db.actor)
  500. end
  501. ]]
  502. end
  503. ----------------------------------------------------------------------------------------------------------------------
  504.  
  505.  
  506. function actor_binder:before_use( item )
  507. if not item then return end
  508. local sobj = alife():object(item:id())
  509. if not sobj then return end
  510.  
  511. self.am:call("on_actor_before_use", item, sobj)
  512.  
  513. end
  514.  
  515.  
  516. function actor_binder:item_to_belt(obj)
  517. if not obj then return end
  518. local sobj = alife():object(obj:id())
  519. if not sobj then return end
  520.  
  521. self.am:call("on_item_to_belt", obj, sobj)
  522.  
  523. end
  524.  
  525. ----------------------------------------------------------------------------------------------------------------------
  526. function actor_binder:item_to_backpack( obj )
  527.  
  528. local sobj = sim:object( obj:id() )
  529. if sobj then
  530. -- ??? ???, ??? ???? ? ????? ????, ? ??? ?? ?? ?
  531. -- ???? ?? ???? ? ???
  532.  
  533. self.am:call("on_item_to_ruck", obj, sobj)
  534.  
  535. end
  536. end
  537. ----------------------------------------------------------------------------------------------------------------------
  538.  
  539. function actor_binder:item_to_slot( obj )
  540. local sobj = sim:object( obj:id() )
  541. if sobj then
  542.  
  543. self.am:call("on_item_to_slot", obj, sobj)
  544.  
  545. end
  546. end
  547. local anim_plays = false
  548. ----------------------------------------------------------------------------------------------------------------------
  549. function actor_binder:on_item_take (obj)
  550. self.am:call("on_take", obj, sobj)
  551.  
  552. if db.actor:has_info( "ui_car_body" ) then
  553. if not anim_plays then
  554. local pickup_anm_sec = "anim_pickup"
  555. local anm_name = "script\\gasmask.anm"
  556. local pickup_anm_time = game.play_hud_motion(1, pickup_anm_sec, "anm_take", true, 1.4)
  557. game.play_hud_anm(anm_name, 0, 0.5, 1, false)
  558. dsh.timeout( pickup_anm_time - 100, function()
  559. anim_plays = nil
  560. end )
  561. dsh.timeout( pickup_anm_time - 300, function()
  562. ogse_body_states.play_pickup_snd(obj)
  563. end )
  564. anim_plays = true
  565. end
  566. end
  567.  
  568. level_tasks.proceed(self.object)
  569. xr_statistic.addArtefact(obj)
  570. --game_stats.update_take_item (obj, self.object)
  571.  
  572. end
  573. ----------------------------------------------------------------------------------------------------------------------
  574. function actor_binder:on_item_drop (obj)
  575. level_tasks.proceed(self.object)
  576.  
  577. self.am:call("on_drop", obj, sobj)
  578.  
  579. if string.find( obj:name(), "silencer" ) then
  580. ogse.check_pistol_slot()
  581. end
  582.  
  583. --game_stats.update_drop_item (obj, self.object)
  584.  
  585. end
  586. ----------------------------------------------------------------------------------------------------------------------
  587.  
  588. function actor_binder:level_border_enter(npc, info_id)
  589. self.actor_detector:actor_enter()
  590. end
  591. ----------------------------------------------------------------------------------------------------------------------
  592. function actor_binder:level_border_exit(npc, info_id)
  593. self.actor_detector:actor_exit()
  594. end
  595. ----------------------------------------------------------------------------------------------------------------------
  596. function actor_binder:info_callback(npc, info_id)
  597.  
  598. self.am:call("on_info", info_id)
  599.  
  600. if info_id=="ui_inventory" then
  601. -- gunsl_items_anims.save_bind()
  602. gunsl_ui_inv_add.inventory_open()
  603. gunsl_ui_inv_add.poloski_update()
  604. gunsl_drag_drop.on_show_inventory()
  605. elseif info_id=="ui_inventory_hide" then
  606. gunsl_ui_inv_add.inventory_close()
  607. gunsl_drag_drop.on_hide_inventory()
  608. ogse_quick_slots.clear_quick_slot_idik()
  609. end
  610.  
  611. if info_id=="ui_pda" then
  612. ogse_body_states.pda_off()
  613. gunsl_items_anims.hide_scaner_scr()
  614. elseif info_id=="ui_pda_hide" then
  615. gunsl_items_anims.restore_scaner_scr()
  616. ogse_body_states.pda_on()
  617. end
  618.  
  619. if info_id=="ui_trade" then
  620. gunsl_ui_inv_add.trade_open()
  621. elseif info_id=="ui_trade_hide" then
  622. gunsl_ui_inv_add.trade_close()
  623. end
  624.  
  625. if info_id=="ui_car_body" then
  626. gunsl_ui_inv_add.body_open()
  627. elseif info_id=="ui_car_body_hide" then
  628. gunsl_ui_inv_add.body_close()
  629. end
  630.  
  631. if info_id == "cit_jail_doctor_pryp_task" then
  632. ogse.actor_change_name()
  633. end
  634.  
  635. printf("*INFO*: npc='%s' id='%s'", npc:name(), info_id)
  636. --' ???
  637. level_tasks.proceed(self.object)
  638. -- ???? ? ???
  639. level_tasks.process_info_portion(info_id)
  640. gunsl_upgrade.show_hide_menu(info_id)
  641. end
  642. ----------------------------------------------------------------------------------------------------------------------
  643. function actor_binder:on_trade (item, sell_bye, money)
  644. if sell_bye == true then
  645. game_stats.money_trade_update (money)
  646. else
  647. game_stats.money_trade_update (-money)
  648. end
  649. end
  650. ----------------------------------------------------------------------------------------------------------------------
  651. function actor_binder:article_callback(npc, group, name)
  652. --printf("article_callback [%s][%s]", group, name)
  653. if device().precache_frame >1 then return end
  654.  
  655. if group == "Diary" then
  656. news_manager.send_encyclopedy("diary", group)
  657. else
  658. news_manager.send_encyclopedy("encyclopedy", group)
  659. end
  660. end
  661. ----------------------------------------------------------------------------------------------------------------------
  662.  
  663. function actor_binder:task_callback(_task, _objective, _state)
  664. task_manager.task_callback(_task:get_id(), _objective:get_idx(), _state)
  665. if _objective:get_idx() == 0 then
  666. if _state == task.fail then
  667. news_manager.send_task(db.actor, "fail", _task, _objective)
  668. elseif _state == task.skipped then
  669. news_manager.send_task(db.actor, "skipped", _task, _objective)
  670. elseif _state == task.completed then
  671. task_manager.reward_by_task(_task)
  672. news_manager.send_task(db.actor, "complete", _task, _objective)
  673. else
  674. news_manager.send_task(db.actor, "new", _task, _objective)
  675. end
  676. else
  677. if _task:get_objective(0):get_state() == task.in_progress then
  678. news_manager.send_task(db.actor, "update", _task, _objective)
  679. end
  680. end
  681. end
  682.  
  683. ----------------------------------------------------------------------------------------------------------------------
  684. function actor_binder:map_location_added_callback(spot_type_str, object_id)
  685. if (false==app_ready()) or (device().precache_frame>1) then return end
  686. --'news_manager.send_task(db.actor, "new")
  687. end
  688. ----------------------------------------------------------------------------------------------------------------------
  689. local first_update
  690. function actor_binder:update(delta)
  691. object_binder.update(self, delta)
  692.  
  693. self.am:call("on_update", delta)
  694.  
  695.  
  696. xr_s.on_update( delta )
  697.  
  698.  
  699. local time = time_global()
  700.  
  701. if not first_update then
  702.  
  703. self.am:call("on_first_update")
  704.  
  705. first_update = true
  706. end
  707.  
  708.  
  709. if get_console():get_bool("hud_draw") then
  710. if (not db.actor:zoom_mode()) then
  711. ogse_quick_slots.FastUseSlotsHud()
  712. gunsl_hud_indicators.show_indicators()
  713. end
  714.  
  715. else
  716. ogse_quick_slots.RemoveFastUseSlotsHud()
  717. gunsl_hud_indicators.remove_indiks()
  718. end
  719.  
  720. gunsl_hud_animations_mgr.get_hud_animations_mgr():update()
  721.  
  722.  
  723. sleep_manager.hp_corrector()
  724.  
  725.  
  726. game_stats.update (delta, self.object)
  727.  
  728. -- ??? ???
  729. self.weather_manager:update()
  730.  
  731. -- ??? ??? ?????
  732. self.actor_detector:update()
  733.  
  734. -- ??? ???? ??? ???
  735. xr_sound.update_actor()
  736.  
  737.  
  738. -- ????? ?????? ??? ? ?????.
  739. if self.st.disable_input_time ~= nil and
  740. game.get_game_time():diffSec(self.st.disable_input_time) >= self.st.disable_input_idle
  741. then
  742. level.enable_input()
  743. self.st.disable_input_time = nil
  744. end
  745. -- ????? ?? ? ????? ???? ? ????? ????
  746. if self.st.sleep_relocate_time ~= nil and
  747. game.get_game_time():diffSec(self.st.sleep_relocate_time) >= self.st.sleep_relocate_idle
  748. then
  749. self.object:set_actor_position(self.st.sleep_relocate_point)
  750. local dir = self.st.sleep_relocate_point:sub(self.st.sleep_relocate_look)
  751. self.object:set_actor_direction(dir:getH())
  752. self.st.sleep_relocate_time = nil
  753. end
  754.  
  755. -- ???? ????? ??? ??? ? ??? ????
  756. if weapon_hide == true or self.object:is_talking() then
  757. if self.weapon_hide == false then
  758. self.object:hide_weapon()
  759. self.weapon_hide = true
  760. end
  761. else
  762. if self.weapon_hide == true then
  763. self.object:restore_weapon()
  764. self.weapon_hide = false
  765. end
  766. end
  767.  
  768. -- ????? ??????, ???? ?? ????, ?????? ??? ????? ????
  769. if self.next_restrictors_update_time < time then
  770. bind_restrictor.actor_update(delta)
  771.  
  772. self.next_restrictors_update_time = time + 200
  773.  
  774. task_manager.actor_update()
  775. end
  776.  
  777. -- ????? ???????
  778. if post_process ~= 0 then
  779. if post_process:update () == true then
  780. post_process = 0
  781. end
  782. end
  783.  
  784. -- ????? ??-????
  785. if sr_psy_antenna.psy_antenna then
  786. sr_psy_antenna.psy_antenna:update(delta)
  787. end
  788.  
  789. --' ??? ????? ? ???? ????
  790. if self.object.radiation >= 0.7 then
  791. local hud = get_hud()
  792. local custom_static = hud:GetCustomStatic("cs_radiation_danger")
  793. if custom_static == nil then
  794. hud:AddCustomStatic("cs_radiation_danger", true)
  795. hud:GetCustomStatic("cs_radiation_danger"):wnd():SetTextST("st_radiation_danger")
  796. end
  797. else
  798. local hud = get_hud()
  799. local custom_static = hud:GetCustomStatic("cs_radiation_danger")
  800. if custom_static ~= nil then
  801. hud:RemoveCustomStatic("cs_radiation_danger")
  802. end
  803. end
  804.  
  805.  
  806.  
  807. if self.bCheckStart then
  808. printf("SET DEFAULT INFOS")
  809.  
  810. if not has_alife_info("storyline_actor_start") and
  811. (level.name() == "l01_escape")
  812. then
  813. self.object:give_info_portion("storyline_actor_start")
  814. _G.g_start_avi = true
  815. printf("*AVI* RUN START AVI")
  816. art_mgr.del_xlam()
  817. ogse.monster_first_run()
  818. end
  819.  
  820. -- if not has_alife_info("encyclopedy") then
  821. -- self.object:give_info_portion("encyclopedy")
  822. -- end
  823.  
  824. if not has_alife_info("global_dialogs") then
  825. self.object:give_info_portion("global_dialogs")
  826. end
  827.  
  828. if not has_alife_info("level_changer_icons") then
  829. self.object:give_info_portion("level_changer_icons")
  830. end
  831.  
  832. level_tasks.add_lchanger_location()
  833.  
  834. self.bCheckStart = false
  835. end
  836. art_mgr.update()
  837. -- naxac +
  838. save_rename.update(time)
  839. -- naxac -
  840. end
  841. ----------------------------------------------------------------------------------------------------------------------
  842. function actor_binder:save(packet)
  843.  
  844. local save_treasure_manager = true
  845.  
  846. printf("actor_binder:save(): self.object:name()='%s'", self.object:name())
  847. object_binder.save(self, packet)
  848.  
  849. --' ????? ???? ?????
  850. if save_treasure_manager == true then
  851. packet:w_u8(level.get_game_difficulty() + 128)
  852. else
  853. packet:w_u8(level.get_game_difficulty())
  854. end
  855.  
  856.  
  857. --' ????? ???? ? ??????? ???
  858. if self.st.disable_input_time == nil then
  859. packet:w_bool(false)
  860. else
  861. packet:w_bool(true)
  862. utils.w_CTime(packet, self.st.disable_input_time)
  863. end
  864.  
  865. xr_logic.pstor_save_all(self.object, packet)
  866. self.weather_manager:save(packet)
  867.  
  868. sr_psy_antenna.save( packet )
  869.  
  870. if save_treasure_manager == true then
  871. treasure_manager.save(packet)
  872. end
  873.  
  874. self.am:call("on_save", packet)
  875.  
  876. task_manager.save(packet)
  877. xr_statistic.save(packet)
  878. self.actor_detector:save(packet)
  879. art_mgr.save(packet)
  880. save_rename.on_save()
  881. end
  882. ----------------------------------------------------------------------------------------------------------------------
  883. function actor_binder:load(reader)
  884. printf("actor_binder:load(): self.object:name()='%s'", self.object:name())
  885. object_binder.load(self, reader)
  886. printf("actor_binder:object_binder.load(): self.object:name()='%s'", self.object:name())
  887.  
  888. --' ????? ???? ?????
  889. local game_difficulty = reader:r_u8()
  890.  
  891. local load_treasure_manager = false
  892. if game_difficulty >= 128 then
  893. game_difficulty = game_difficulty - 128
  894. load_treasure_manager = true
  895. end
  896.  
  897.  
  898. get_console():execute("g_game_difficulty "..game_difficulty_by_num[game_difficulty])
  899.  
  900. if reader:r_eof() then
  901. abort("SAVE FILE IS CORRUPT")
  902. end
  903.  
  904. local stored_input_time = reader:r_u8()
  905. if stored_input_time == true then
  906. self.st.disable_input_time = utils.r_CTime(reader)
  907. end
  908.  
  909. xr_logic.pstor_load_all(self.object, reader)
  910. self.weather_manager:load(reader)
  911.  
  912. sr_psy_antenna.load(reader)
  913.  
  914. if load_treasure_manager == true then
  915. treasure_manager.load(reader)
  916. end
  917.  
  918. self.am:call("on_load", reader)
  919.  
  920. task_manager.load(reader)
  921. xr_statistic.load(reader)
  922. self.actor_detector:load(reader)
  923. art_mgr.load(reader)
  924. ogsm_freeplay.mark_lc()
  925.  
  926.  
  927. end
  928. ----------------------------------------------------------------------------------------------------------------------
  929.  
  930. --??? ????? ???
  931. --if string.find(command_line(), "-noprefetch") == nil then
  932. -- sound_prefetch.prefetch_sounds()
  933. --end
  934.  
  935.  
  936. -- Weapon functions
  937. function hide_weapon()
  938. weapon_hide = true
  939. end
  940. function restore_weapon()
  941. weapon_hide = false
  942. end
  943.  
  944. // this is test for section iteration
  945. /**
  946. local function test_section_iteration(file_name, section_name)
  947. printf ("file : %s",file_name)
  948. printf ("section : %s",section_name)
  949.  
  950. local file = ini_file(file_name)
  951. local n = file:line_count(section_name)
  952. printf ("lines : %d",n)
  953.  
  954. local id, value = "", "", result
  955. for i=0,n-1 do
  956. result, id, value = file:r_line(section_name,i,"","")
  957. printf ("line %d : %s = %s",i,id,value)
  958. end
  959. end
  960.  
  961. test_section_iteration("system.ltx","space_restrictor")
  962. /**/
  963.  
  964.  
  965.  
Advertisement
Add Comment
Please, Sign In to add comment