Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local donation = require("donation_interactive")
- function init(obj)
- xr_motivator.AddToMotivator(obj)
- end
- function actor_init(npc)
- npc:bind_object(actor_binder(npc))
- end
- local sim = alife()
- local game_difficulty_by_num = {
- [0] = "gd_novice",
- [1] = "gd_stalker",
- [2] = "gd_veteran",
- [3] = "gd_master"
- }
- lasthealth = 0
- lasttime = 0
- post_process = 0
- local weapon_hide = false
- ----------------------------------------------------------------------------------------------------------------------
- class "actor_binder" (object_binder)
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:__init (obj) super(obj)
- self.am = ogse_signals.get_mgr()
- self.am:call( "on_load_before_all" )
- self.am:call( "on_init", obj )
- self.bCheckStart = false
- self.weather_manager = level_weathers.WeatherManager()
- self.actor_detector = xr_detector.actor_detector()
- end
- function actor_binder:__finalize()
- self.am:call( "on_finalize" )
- xr_s.init()
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:net_spawn(data)
- printf("actor net spawn")
- level.show_indicators()
- self.bCheckStart = true
- self.weapon_hide = false -- ???? ?? ?? ??? ?? ?????.
- weapon_hide = false -- ??????? ?????? ?????? ??.
- if object_binder.net_spawn(self,data) == false then
- return false
- end
- db.add_actor(self.object)
- if self.st.disable_input_time == nil then
- level.enable_input()
- end
- self.weather_manager:reset()
- -- game_stats.initialize ()
- if(actor_stats.add_to_ranking~=nil)then
- actor_stats.add_to_ranking(self.object:id())
- end
- --' ????? ????? ???
- death_manager.init_drop_settings()
- self.am:call("on_spawn", data)
- return true
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:net_destroy()
- if(actor_stats.remove_from_ranking~=nil)then
- actor_stats.remove_from_ranking(self.object:id())
- end
- -- game_stats.shutdown ()
- db.del_actor(self.object)
- sr_light.clean_up ()
- self.object:set_callback(callback.inventory_info, nil)
- self.object:set_callback(callback.article_info, nil)
- self.object:set_callback(callback.on_item_take, nil)
- self.object:set_callback(callback.on_item_drop, nil)
- --self.object:set_callback(callback.actor_sleep, nil)
- self.object:set_callback(callback.task_state, nil)
- self.object:set_callback(callback.level_border_enter, nil)
- self.object:set_callback(callback.level_border_exit, nil)
- self.object:set_callback(callback.take_item_from_box, nil)
- self.object:set_callback( callback.on_before_use_item, nil )
- self.object:set_callback(callback.use_object, nil)
- self.object:set_callback(callback.on_belt, nil)
- self.object:set_callback( callback.on_ruck, nil )
- self.object:set_callback( callback.on_slot, nil )
- self.object:set_callback( callback.on_key_press, nil )
- self.object:set_callback( callback.on_key_release, nil )
- self.object:set_callback( callback.on_key_hold, nil )
- self.object:set_callback( callback.on_mouse_wheel, nil )
- self.object:set_callback( callback.on_mouse_move, nil )
- self.object:set_callback( callback.on_cell_item_focus, nil )
- self.object:set_callback( callback.on_cell_item_focus_lost, nil )
- self.object:set_callback( callback.on_cell_item_mouse, nil )
- self.object:set_callback(callback.hit, nil)
- self.object:set_callback(callback.entity_alive_before_hit, nil)
- self.object:set_callback(callback.on_actor_step, nil)
- self.object:set_callback(callback.death, nil)
- self.object:set_callback(callback.level_changer_action, nil)
- self.object:set_callback(callback.on_actor_quickknifehit, nil)
- self.object:set_callback(callback.on_actor_anim_pnv_on, nil)
- self.object:set_callback(callback.update_artefacts_on_belt, nil)
- self.object:set_callback(callback.on_actor_firemode, nil)
- self.object:set_callback(callback.weapon_fired, nil)
- self.object:set_callback(callback.on_actor_wpndraw, nil)
- self.object:set_callback(callback.on_actor_wpnholster, nil)
- self.object:set_callback(callback.on_actor_jump, nil)
- self.object:set_callback(callback.on_actor_land, nil)
- self.object:set_callback(callback.on_actor_weapon_zoom_in, nil)
- self.object:set_callback(callback.on_actor_weapon_zoom_out, nil)
- if sr_psy_antenna.psy_antenna then
- sr_psy_antenna.psy_antenna:destroy()
- sr_psy_antenna.psy_antenna = false
- end
- xr_sound.stop_all_sound_object()
- self.am:call("on_destroy")
- object_binder.net_destroy(self)
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:reinit()
- object_binder.reinit(self)
- local npc_id = self.object:id()
- db.storage[npc_id] = { }
- self.st = db.storage[npc_id]
- self.st.pstor = nil
- self.next_restrictors_update_time = -10000
- self.object:set_callback(callback.inventory_info, self.info_callback, self)
- self.object:set_callback(callback.article_info, self.article_callback, self)
- self.object:set_callback(callback.on_item_take, self.on_item_take, self)
- self.object:set_callback(callback.on_item_drop, self.on_item_drop, self)
- self.object:set_callback(callback.trade_sell_buy_item, self.on_trade, self) -- for game stats
- self.object:set_callback(callback.task_state, self.task_callback, self)
- self.object:set_callback(callback.level_border_enter, self.level_border_enter, self)
- self.object:set_callback(callback.level_border_exit, self.level_border_exit, self)
- self.object:set_callback(callback.take_item_from_box, self.take_item_from_box, self)
- self.object:set_callback(callback.use_object, self.use_object, self)
- self.object:set_callback( callback.on_before_use_item, self.before_use, self )
- self.object:set_callback(callback.on_belt, self.item_to_belt, self)
- self.object:set_callback( callback.on_ruck, self.item_to_backpack, self )
- self.object:set_callback( callback.on_slot, self.item_to_slot, self )
- self.object:set_callback( callback.on_key_press, self.on_key, self )
- self.object:set_callback( callback.on_key_release, self.on_key_free, self )
- self.object:set_callback( callback.on_key_hold, self.on_key_hold, self )
- self.object:set_callback( callback.on_mouse_wheel, self.on_wheel_rotation, self )
- self.object:set_callback( callback.on_mouse_move, self.on_mouse_move, self )
- self.object:set_callback( callback.on_cell_item_focus, self.on_cell_item_focus, self )
- self.object:set_callback( callback.on_cell_item_focus_lost, self.on_cell_item_focus_lost, self )
- self.object:set_callback( callback.on_cell_item_mouse, self.on_cell_item_mouse, self )
- self.object:set_callback(callback.hit, self.actor_hit_callback, self)
- self.object:set_callback(callback.entity_alive_before_hit, self.before_hit_callback, self)
- self.object:set_callback(callback.death, self.actor_death_callback, self)
- self.object:set_callback(callback.on_actor_step, self.on_actor_step_callback, self)
- self.object:set_callback(callback.level_changer_action, self.level_changer_action, self)
- self.object:set_callback( callback.on_actor_quickknifehit, self.quickknifehit, self )
- self.object:set_callback( callback.on_actor_anim_pnv_on, self.actor_anim_pnv_on, self )
- self.object:set_callback( callback.on_actor_firemode, self.on_actor_firemode_change, self )
- self.object:set_callback(callback.update_artefacts_on_belt, self.update_artefacts_on_belt, self)
- self.object:set_callback(callback.weapon_fired, self.on_weapon_fired, self)
- self.object:set_callback(callback.on_actor_wpndraw, self.actor_wpndraw, self)
- self.object:set_callback(callback.on_actor_wpnholster, self.actor_wpnholster, self)
- self.object:set_callback(callback.on_actor_jump, self.actor_jump, self)
- self.object:set_callback(callback.on_actor_land, self.actor_land, self)
- self.object:set_callback(callback.on_actor_weapon_zoom_in, self.on_actor_weapon_zoom_in, self)
- self.object:set_callback(callback.on_actor_weapon_zoom_out, self.on_actor_weapon_zoom_out, self)
- self.am:call("on_reinit")
- end
- function actor_binder:actor_jump()
- end
- function actor_binder:actor_land()
- local rand = math.random(1,2)
- level.add_cam_effector("camera_effects\\landing_crp" .. rand .. ".anm", 1905, false, "")
- local land_snd = xr_sound.get_safe_sound_object("actor\\jump_sounds\\land_default")
- land_snd:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 0.6)
- end
- local snd_using
- function actor_binder:actor_wpndraw()
- dsh.timeout( 100, function()
- local act_it = db.actor:active_item()
- if act_it then
- local snd2 = get_string( act_it:section(), "snd_draw" )
- snd_using = sound_object(snd2)
- if not snd_using:playing() then
- snd_using:play( db.actor, 0, sound_object.s2d )
- end
- end
- end )
- end
- function actor_binder:actor_wpnholster()
- dsh.timeout( 100, function()
- local act_it = db.actor:active_item()
- if act_it then
- local snd2 = get_string( act_it:section(), "snd_holster" )
- snd_using = sound_object(snd2)
- if not snd_using:playing() then
- snd_using:play( db.actor, 0, sound_object.s2d )
- end
- end
- end )
- end
- function actor_binder:before_hit_callback(hit_data)
- self.am:call("on_actor_before_hit", hit_data)
- local obj = hit_data.who
- if obj then
- local hit_type = hit_data.hit_type
- if hit_type == hit.telepatic then
- if hit_data.who_id == db.actor:id() then
- local cdir = device().cam_dir
- local angle_down = cdir.y
- log1(angle_down)
- if angle_down <= -0.95 or angle_down >= 0.95 then
- return
- else
- local flash_snd = xr_sound.get_safe_sound_object([[weapons\zarya2_flash]])
- flash_snd:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 1.0)
- level.add_pp_effector ("teleport.ppe", 2009, false)
- end
- end
- elseif hit_type == hit.burn then
- if db.actor:dont_has_info( "actor_burning" ) then
- db.actor:give_info_portion("actor_burning")
- end
- end
- end
- end
- function actor_binder:on_actor_firemode_change( obj )
- local act_it = db.actor:active_item()
- if act_it and db.actor:zoom_mode() then
- local firemode = get_float( act_it:section(), "firemod_status" )
- if firemode and firemode == 1 then
- anm_name2 = "camera_effects\\weapon\\l85_gloff_firemode_a_to_1.anm"
- game.play_hud_anm(anm_name2, 2, 1, 1, false)
- level.add_cam_effector("camera_effects\\weapon\\l85_gloff_firemode_a_to_1.anm", 1902, false, "")
- end
- end
- end
- function actor_binder:on_weapon_fired()
- ogse_body_states.on_weapon_fired()
- ogse_body_states.actor_on_weapon_fire()
- end
- function actor_binder:update_artefacts_on_belt(dt)
- self.am:call("update_artefacts_on_belt", dt)
- end
- function actor_binder:quickknifehit( obj )
- start_real_timer("kick_hit", 150, "gunsl_hud_animations_mgr.get_hud_animations_mgr():kick_hit_melee")
- end
- function actor_binder:actor_anim_pnv_on( obj )
- start_real_timer("on_off_pnv", 400, "ogse_night_vision.on_off_pnv")
- local snd_nv = sound_object('weapons\\nv_deact')
- snd_nv:play(db.actor, 0, sound_object.s2d)
- end
- function actor_binder:on_actor_step_callback( obj, material, power )
- ogse_body_states.actor_on_exo_footstep(obj, material, power)
- end
- function actor_binder:actor_death_callback(victim, who)
- gunsl_3dscopes_backlight.on_zoom_out_night()
- local hud = get_hud()
- if hud:GetCustomStatic("gunsl_nv_screen_mask")~=nil then
- hud:RemoveCustomStatic("gunsl_nv_screen_mask")
- end
- level.add_cam_effector("camera_effects\\surge_02.anm", 2532, false, "")
- level.add_pp_effector("surge_fade.ppe", 2011, true)
- start_real_timer("death_wake", 1300, "bind_stalker.death_wake")
- level.disable_input()
- end
- function death_wake()
- level.add_pp_effector("deadcity_wake.ppe", 4467, true)
- end
- function actor_binder:on_wheel_rotation( vol )
- xr_s.on_event("mouse_wheel", vol)
- end
- function actor_binder:on_mouse_move( velx, vely )
- end
- function actor_binder:on_cell_item_focus( obj )
- xr_s.on_event("cell_item_focus", obj)
- gunsl_drag_drop.on_cell_item_focus( obj )
- end
- function actor_binder:on_cell_item_focus_lost( obj )
- xr_s.on_event("cell_item_focus_lost", obj)
- gunsl_drag_drop.on_cell_item_focus_lost( obj )
- end
- function actor_binder:on_cell_item_mouse( obj, x, y, action )
- gunsl_drag_drop.on_cell_item_mouse( obj, x, y, action )
- end
- function actor_binder:level_changer_action( obj, wnd )
- local sobj = obj:get_alife_object()
- local lc = sobj:get_level_changer()
- local dest_vertex = lc.dest_game_vertex_id
- local dest_lname = alife():level_name(
- game_graph():vertex( dest_vertex ):level_id()
- )
- if db.actor:has_info( "ui_inventory" ) then
- level.start_stop_menu( level.main_input_receiver(), true )
- end
- local msg_text_wnd = wnd:FindChild( "message_box_change_level:button_yes" )
- if db.actor:has_info( "anim_action" ) then
- level.only_allow_movekeys(false)
- msg_text_wnd:GetCUIStatic():SetWndRect( Frect():set( -1000, 365, 117, 29 ) )
- else
- msg_text_wnd:GetCUIStatic():SetWndRect( Frect():set( 250, 154, 367, 183 ) )
- end
- end
- function actor_binder:actor_hit_callback(obj, amount, local_direction, who, bone_index)
- if who and who:id()~=db.actor:id() and amount > 0 then
- ogse_critical_hit.check_critical(amount, bone_index, who)
- ogse_critical_hit.helmet_damage(amount, bone_index, who)
- if IsMonster(who) then
- local mob_id = class_id or get_clsid (who)
- 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
- if amount > 0.20 then
- if db.actor:see(who) then
- bind_monster.boar_strike()
- end
- end
- end
- end
- if IsAnomaly(who) then
- local sect = who:section()
- if string.find(sect, "zharka") then
- if db.actor:dont_has_info( "actor_burning" ) then
- db.actor:give_info_portion("actor_burning")
- end
- end
- end
- end
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:on_actor_weapon_zoom_in( obj )
- local wpni = db.actor:active_item()
- if wpni then
- if ogse_wpn_utils.get_zoom_anm_status( wpni ) == 1 then
- local anm_name = "aim_in.anm"
- game.play_hud_anm(anm_name, 2, 1.0, 1, false)
- local snd = get_string(wpni:section(), "snd_aim_start")
- local snd_obj = sound_object(snd)
- if not snd_obj:playing() then
- snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 0.3)
- end
- end
- end
- if not get_console():get_bool("g_3d_scopes") then
- if db.actor:active_item():get_weapon():UseScopeTexture() then
- gunsl_hud_indicators.remove_indiks()
- ogse_quick_slots.RemoveFastUseSlotsHud()
- end
- end
- end
- function actor_binder:on_actor_weapon_zoom_out( obj )
- local wpni = db.actor:active_item()
- if wpni then
- if ogse_wpn_utils.get_zoom_anm_status( wpni ) == 1 then
- local anm_name = "aim_out.anm"
- game.play_hud_anm(anm_name, 2, 1.0, 1, false)
- local snd = get_string(wpni:section(), "snd_aim_end")
- local snd_obj = sound_object(snd)
- if not snd_obj:playing() then
- snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 0.3)
- end
- end
- end
- if not get_console():get_bool("g_3d_scopes") then
- if db.actor:active_item():get_weapon():UseScopeTexture() then
- gunsl_hud_indicators.show_indicators()
- ogse_quick_slots.FastUseSlotsHud()
- end
- end
- end
- local keyboard_events = {
- [ "on_key_down" ] = "on_key_down",
- [ "on_key_hold" ] = "on_key_hold",
- [ "on_key_up" ] = "on_key_up",
- }
- local kShifts = { [DIK_keys.DIK_RSHIFT] = true, [DIK_keys.DIK_LSHIFT] = true }
- function actor_binder:on_key(key, bind)
- self.am:call("on_key_down", key, bind)
- xr_s.on_event( "key_press", key, bind )
- gunsl_hud_animations_mgr.get_hud_animations_mgr():on_keyboard(key, bind)
- end
- function actor_binder:on_key_free(key, bind)
- self.am:call("on_key_up", key, bind)
- end
- function actor_binder:on_key_hold(key, bind)
- end
- function actor_binder:take_item_from_box(box, item)
- local story_id = box:story_id()
- if story_id == nil then
- return
- end
- treasure_manager.take_item_from_box(box, story_id)
- --[[
- local respawner = se_respawn.get_respawner_by_parent(story_id)
- if respawner == nil then
- return
- end
- --' ?????? ?????? ???? ? ?????
- respawner:remove_spawned(item:id())
- local smart_terrain = db.strn_by_respawn[respawner:name()]
- if smart_terrain == nil then
- return
- end
- local npc = smart_terrain.gulag:get_nearest_online_obj(db.actor:position())
- if npc ~= nil then
- xr_sound.set_sound_play(npc, "reac_box")
- xr_gulag.setGulagEnemy(smart_terrain:name() , db.actor)
- end
- ]]
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:before_use( item )
- if not item then return end
- local sobj = alife():object(item:id())
- if not sobj then return end
- self.am:call("on_actor_before_use", item, sobj)
- end
- function actor_binder:item_to_belt(obj)
- if not obj then return end
- local sobj = alife():object(obj:id())
- if not sobj then return end
- self.am:call("on_item_to_belt", obj, sobj)
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:item_to_backpack( obj )
- local sobj = sim:object( obj:id() )
- if sobj then
- -- ??? ???, ??? ???? ? ????? ????, ? ??? ?? ?? ?
- -- ???? ?? ???? ? ???
- self.am:call("on_item_to_ruck", obj, sobj)
- end
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:item_to_slot( obj )
- local sobj = sim:object( obj:id() )
- if sobj then
- self.am:call("on_item_to_slot", obj, sobj)
- end
- end
- local anim_plays = false
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:on_item_take (obj)
- self.am:call("on_take", obj, sobj)
- if db.actor:has_info( "ui_car_body" ) then
- if not anim_plays then
- local pickup_anm_sec = "anim_pickup"
- local anm_name = "script\\gasmask.anm"
- local pickup_anm_time = game.play_hud_motion(1, pickup_anm_sec, "anm_take", true, 1.4)
- game.play_hud_anm(anm_name, 0, 0.5, 1, false)
- dsh.timeout( pickup_anm_time - 100, function()
- anim_plays = nil
- end )
- dsh.timeout( pickup_anm_time - 300, function()
- ogse_body_states.play_pickup_snd(obj)
- end )
- anim_plays = true
- end
- end
- level_tasks.proceed(self.object)
- xr_statistic.addArtefact(obj)
- --game_stats.update_take_item (obj, self.object)
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:on_item_drop (obj)
- level_tasks.proceed(self.object)
- self.am:call("on_drop", obj, sobj)
- if string.find( obj:name(), "silencer" ) then
- ogse.check_pistol_slot()
- end
- --game_stats.update_drop_item (obj, self.object)
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:level_border_enter(npc, info_id)
- self.actor_detector:actor_enter()
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:level_border_exit(npc, info_id)
- self.actor_detector:actor_exit()
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:info_callback(npc, info_id)
- self.am:call("on_info", info_id)
- if info_id=="ui_inventory" then
- -- gunsl_items_anims.save_bind()
- gunsl_ui_inv_add.inventory_open()
- gunsl_ui_inv_add.poloski_update()
- gunsl_drag_drop.on_show_inventory()
- elseif info_id=="ui_inventory_hide" then
- gunsl_ui_inv_add.inventory_close()
- gunsl_drag_drop.on_hide_inventory()
- ogse_quick_slots.clear_quick_slot_idik()
- end
- if info_id=="ui_pda" then
- ogse_body_states.pda_off()
- gunsl_items_anims.hide_scaner_scr()
- elseif info_id=="ui_pda_hide" then
- gunsl_items_anims.restore_scaner_scr()
- ogse_body_states.pda_on()
- end
- if info_id=="ui_trade" then
- gunsl_ui_inv_add.trade_open()
- elseif info_id=="ui_trade_hide" then
- gunsl_ui_inv_add.trade_close()
- end
- if info_id=="ui_car_body" then
- gunsl_ui_inv_add.body_open()
- elseif info_id=="ui_car_body_hide" then
- gunsl_ui_inv_add.body_close()
- end
- if info_id == "cit_jail_doctor_pryp_task" then
- ogse.actor_change_name()
- end
- printf("*INFO*: npc='%s' id='%s'", npc:name(), info_id)
- --' ???
- level_tasks.proceed(self.object)
- -- ???? ? ???
- level_tasks.process_info_portion(info_id)
- gunsl_upgrade.show_hide_menu(info_id)
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:on_trade (item, sell_bye, money)
- if sell_bye == true then
- game_stats.money_trade_update (money)
- else
- game_stats.money_trade_update (-money)
- end
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:article_callback(npc, group, name)
- --printf("article_callback [%s][%s]", group, name)
- if device().precache_frame >1 then return end
- if group == "Diary" then
- news_manager.send_encyclopedy("diary", group)
- else
- news_manager.send_encyclopedy("encyclopedy", group)
- end
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:task_callback(_task, _objective, _state)
- task_manager.task_callback(_task:get_id(), _objective:get_idx(), _state)
- if _objective:get_idx() == 0 then
- if _state == task.fail then
- news_manager.send_task(db.actor, "fail", _task, _objective)
- elseif _state == task.skipped then
- news_manager.send_task(db.actor, "skipped", _task, _objective)
- elseif _state == task.completed then
- task_manager.reward_by_task(_task)
- news_manager.send_task(db.actor, "complete", _task, _objective)
- else
- news_manager.send_task(db.actor, "new", _task, _objective)
- end
- else
- if _task:get_objective(0):get_state() == task.in_progress then
- news_manager.send_task(db.actor, "update", _task, _objective)
- end
- end
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:map_location_added_callback(spot_type_str, object_id)
- if (false==app_ready()) or (device().precache_frame>1) then return end
- --'news_manager.send_task(db.actor, "new")
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:update(delta)
- donation = donation or require("donation_interactive")
- donation.Update(delta)
- object_binder.update(self, delta)
- self.am:call("on_update", delta)
- xr_s.on_update( delta )
- local time = time_global()
- if not first_update then
- self.am:call("on_first_update")
- first_update = true
- end
- if get_console():get_bool("hud_draw") then
- if (not db.actor:zoom_mode()) then
- ogse_quick_slots.FastUseSlotsHud()
- gunsl_hud_indicators.show_indicators()
- end
- else
- ogse_quick_slots.RemoveFastUseSlotsHud()
- gunsl_hud_indicators.remove_indiks()
- end
- gunsl_hud_animations_mgr.get_hud_animations_mgr():update()
- sleep_manager.hp_corrector()
- game_stats.update (delta, self.object)
- -- ??? ???
- self.weather_manager:update()
- -- ??? ??? ?????
- self.actor_detector:update()
- -- ??? ???? ??? ???
- xr_sound.update_actor()
- -- ????? ?????? ??? ? ?????.
- if self.st.disable_input_time ~= nil and
- game.get_game_time():diffSec(self.st.disable_input_time) >= self.st.disable_input_idle
- then
- level.enable_input()
- self.st.disable_input_time = nil
- end
- -- ????? ?? ? ????? ???? ? ????? ????
- if self.st.sleep_relocate_time ~= nil and
- game.get_game_time():diffSec(self.st.sleep_relocate_time) >= self.st.sleep_relocate_idle
- then
- self.object:set_actor_position(self.st.sleep_relocate_point)
- local dir = self.st.sleep_relocate_point:sub(self.st.sleep_relocate_look)
- self.object:set_actor_direction(dir:getH())
- self.st.sleep_relocate_time = nil
- end
- -- ???? ????? ??? ??? ? ??? ????
- if weapon_hide == true or self.object:is_talking() then
- if self.weapon_hide == false then
- self.object:hide_weapon()
- self.weapon_hide = true
- end
- else
- if self.weapon_hide == true then
- self.object:restore_weapon()
- self.weapon_hide = false
- end
- end
- -- ????? ??????, ???? ?? ????, ?????? ??? ????? ????
- if self.next_restrictors_update_time < time then
- bind_restrictor.actor_update(delta)
- self.next_restrictors_update_time = time + 200
- task_manager.actor_update()
- end
- -- ????? ???????
- if post_process ~= 0 then
- if post_process:update () == true then
- post_process = 0
- end
- end
- -- ????? ??-????
- if sr_psy_antenna.psy_antenna then
- sr_psy_antenna.psy_antenna:update(delta)
- end
- --' ??? ????? ? ???? ????
- if self.object.radiation >= 0.7 then
- local hud = get_hud()
- local custom_static = hud:GetCustomStatic("cs_radiation_danger")
- if custom_static == nil then
- hud:AddCustomStatic("cs_radiation_danger", true)
- hud:GetCustomStatic("cs_radiation_danger"):wnd():SetTextST("st_radiation_danger")
- end
- else
- local hud = get_hud()
- local custom_static = hud:GetCustomStatic("cs_radiation_danger")
- if custom_static ~= nil then
- hud:RemoveCustomStatic("cs_radiation_danger")
- end
- end
- if self.bCheckStart then
- printf("SET DEFAULT INFOS")
- if not has_alife_info("storyline_actor_start") and
- (level.name() == "l01_escape")
- then
- self.object:give_info_portion("storyline_actor_start")
- _G.g_start_avi = true
- printf("*AVI* RUN START AVI")
- art_mgr.del_xlam()
- ogse.monster_first_run()
- end
- -- if not has_alife_info("encyclopedy") then
- -- self.object:give_info_portion("encyclopedy")
- -- end
- if not has_alife_info("global_dialogs") then
- self.object:give_info_portion("global_dialogs")
- end
- if not has_alife_info("level_changer_icons") then
- self.object:give_info_portion("level_changer_icons")
- end
- level_tasks.add_lchanger_location()
- self.bCheckStart = false
- end
- art_mgr.update()
- -- naxac +
- save_rename.update(time)
- -- naxac -
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:save(packet)
- local save_treasure_manager = true
- printf("actor_binder:save(): self.object:name()='%s'", self.object:name())
- object_binder.save(self, packet)
- --' ????? ???? ?????
- if save_treasure_manager == true then
- packet:w_u8(level.get_game_difficulty() + 128)
- else
- packet:w_u8(level.get_game_difficulty())
- end
- --' ????? ???? ? ??????? ???
- if self.st.disable_input_time == nil then
- packet:w_bool(false)
- else
- packet:w_bool(true)
- utils.w_CTime(packet, self.st.disable_input_time)
- end
- xr_logic.pstor_save_all(self.object, packet)
- self.weather_manager:save(packet)
- sr_psy_antenna.save( packet )
- if save_treasure_manager == true then
- treasure_manager.save(packet)
- end
- self.am:call("on_save", packet)
- task_manager.save(packet)
- xr_statistic.save(packet)
- self.actor_detector:save(packet)
- art_mgr.save(packet)
- save_rename.on_save()
- end
- ----------------------------------------------------------------------------------------------------------------------
- function actor_binder:load(reader)
- printf("actor_binder:load(): self.object:name()='%s'", self.object:name())
- object_binder.load(self, reader)
- printf("actor_binder:object_binder.load(): self.object:name()='%s'", self.object:name())
- --' ????? ???? ?????
- local game_difficulty = reader:r_u8()
- local load_treasure_manager = false
- if game_difficulty >= 128 then
- game_difficulty = game_difficulty - 128
- load_treasure_manager = true
- end
- get_console():execute("g_game_difficulty "..game_difficulty_by_num[game_difficulty])
- if reader:r_eof() then
- abort("SAVE FILE IS CORRUPT")
- end
- local stored_input_time = reader:r_u8()
- if stored_input_time == true then
- self.st.disable_input_time = utils.r_CTime(reader)
- end
- xr_logic.pstor_load_all(self.object, reader)
- self.weather_manager:load(reader)
- sr_psy_antenna.load(reader)
- if load_treasure_manager == true then
- treasure_manager.load(reader)
- end
- self.am:call("on_load", reader)
- task_manager.load(reader)
- xr_statistic.load(reader)
- self.actor_detector:load(reader)
- art_mgr.load(reader)
- ogsm_freeplay.mark_lc()
- end
- ----------------------------------------------------------------------------------------------------------------------
- --??? ????? ???
- --if string.find(command_line(), "-noprefetch") == nil then
- -- sound_prefetch.prefetch_sounds()
- --end
- -- Weapon functions
- function hide_weapon()
- weapon_hide = true
- end
- function restore_weapon()
- weapon_hide = false
- end
- // this is test for section iteration
- /**
- local function test_section_iteration(file_name, section_name)
- printf ("file : %s",file_name)
- printf ("section : %s",section_name)
- local file = ini_file(file_name)
- local n = file:line_count(section_name)
- printf ("lines : %d",n)
- local id, value = "", "", result
- for i=0,n-1 do
- result, id, value = file:r_line(section_name,i,"","")
- printf ("line %d : %s = %s",i,id,value)
- end
- end
- test_section_iteration("system.ltx","space_restrictor")
- /**/
Advertisement
Add Comment
Please, Sign In to add comment