From bcc6616e955049978e92c212bb8fe788852216b6 Mon Sep 17 00:00:00 2001 From: Decane Date: Sun, 15 Oct 2023 22:59:36 +0100 Subject: [PATCH] Fixed sound_end/theme_end signals sometimes not firing --- .../gamedata/scripts/bind_physic_object.script | 4 ++-- .../gamedata/scripts/bind_physic_object.script | 4 ++-- SRP v1.1.4 - Readme.txt | 1 + SRP v1.1.4 - Version History.txt | 1 + gamedata/scripts/bind_heli.script | 4 ++-- gamedata/scripts/bind_physic_object.script | 4 ++-- gamedata/scripts/bind_restrictor.script | 9 +++++++-- gamedata/scripts/xr_motivator.script | 8 ++++---- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Optional Features/#2. (Choose From This Folder Last)/Prefilled Randomized Stashes/gamedata/scripts/bind_physic_object.script b/Optional Features/#2. (Choose From This Folder Last)/Prefilled Randomized Stashes/gamedata/scripts/bind_physic_object.script index 5d989528..e95baa93 100644 --- a/Optional Features/#2. (Choose From This Folder Last)/Prefilled Randomized Stashes/gamedata/scripts/bind_physic_object.script +++ b/Optional Features/#2. (Choose From This Folder Last)/Prefilled Randomized Stashes/gamedata/scripts/bind_physic_object.script @@ -125,11 +125,11 @@ function generic_physics_binder:update(delta) -- called 6th end end + xr_sound.update(obj:id()) -- DC20231015 + if obj_st.active_scheme then xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta) end - - xr_sound.update(obj:id()) end -------------------------------------------------------------------------------- diff --git a/Optional Features/#2. (Choose From This Folder Last)/Prefilled Stashes/gamedata/scripts/bind_physic_object.script b/Optional Features/#2. (Choose From This Folder Last)/Prefilled Stashes/gamedata/scripts/bind_physic_object.script index 5d989528..e95baa93 100644 --- a/Optional Features/#2. (Choose From This Folder Last)/Prefilled Stashes/gamedata/scripts/bind_physic_object.script +++ b/Optional Features/#2. (Choose From This Folder Last)/Prefilled Stashes/gamedata/scripts/bind_physic_object.script @@ -125,11 +125,11 @@ function generic_physics_binder:update(delta) -- called 6th end end + xr_sound.update(obj:id()) -- DC20231015 + if obj_st.active_scheme then xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta) end - - xr_sound.update(obj:id()) end -------------------------------------------------------------------------------- diff --git a/SRP v1.1.4 - Readme.txt b/SRP v1.1.4 - Readme.txt index 47aa034a..45909a2b 100644 --- a/SRP v1.1.4 - Readme.txt +++ b/SRP v1.1.4 - Readme.txt @@ -130,6 +130,7 @@ Quest fixes: + Fixed an onslaught of tasks being suddenly received and completed in the Abandoned Hospital if the player kills the sniper earlier than intended. + Fixed the issue where the player could break the storyline at Agroprom by killing the Duty outpost commander while he is speaking or by leaving the map before he has finished. + Fixed the "Help the stalkers" task in Agroprom being cancelled immediately after being received if the loner faction is hostile to the player. ++ Fixed the storyline potentially breaking in saves created immediately after Sidorovich's first audio transmission to the player upon entering the Cordon. + Fixed the storyline breaking if the player kills every stalker in the Cordon stalker base before extracting the location of Sidorovich's loot from Khaletskiy, even after paying Sidorovich to set things right with the stalkers. + Fixed the storyline temporarily breaking if the player suppresses the Limansk military machine gun nest during the interval between receiving and completing the task to speak to the Clear Sky squad commander. + Fixed the storyline breaking if the player speaks to Forester before responding to the SOS signal in the Red Forest. diff --git a/SRP v1.1.4 - Version History.txt b/SRP v1.1.4 - Version History.txt index b39f8e98..0ddd17dc 100644 --- a/SRP v1.1.4 - Version History.txt +++ b/SRP v1.1.4 - Version History.txt @@ -12,6 +12,7 @@ v1.1.4 + Fixed a rare crash caused by too many stalkers trying to enter the 'Small old wagon' at the Dark Valley: smart_terrain.script:483: Insufficient smart_terrain jobs val_smart_terrain_9_6. - Decane + Fixed a rare crash caused by too many stalkers trying to enter the 'Camp amidst rocks' at the Army Warehouses: smart_terrain.script:483: Insufficient smart_terrain jobs mil_smart_terrain_2_1 (new game required for effect). - Decane + Fixed NPCs becoming corrupted in the rare (but possible) case where the game attempts to load their logic before initializing the player, thus creating an opportunity for save corruption. - Decane ++ Fixed the issue where a sound_end and/or theme_end signal would be registered and processed in successive calls of the relevant object binder's update() routine, opening time windows in which saving the game could generate a save with stuck logic scripts. - Decane + Fixed NPCs not settling into their sleeping animation at some sleep waypoints. - Decane + Fixed campfire NPCs sometimes not settling into their campfire idle animation. - Decane + Fixed sniper NPCs not settling back into their scan-for-targets state after an enemy detection timeout. - Decane diff --git a/gamedata/scripts/bind_heli.script b/gamedata/scripts/bind_heli.script index 88f9d67c..a78cffeb 100644 --- a/gamedata/scripts/bind_heli.script +++ b/gamedata/scripts/bind_heli.script @@ -65,13 +65,13 @@ function heli_binder:update(delta) -- called 6th xr_logic.initialize_obj(self.object, obj_st, self.loaded, modules.stype_heli) end + xr_sound.update(self.object:id()) -- DC20231015 + if obj_st.active_scheme then xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta) end self:check_health() - - xr_sound.update(self.object:id()) end -------------------------------------------------------------------------------- diff --git a/gamedata/scripts/bind_physic_object.script b/gamedata/scripts/bind_physic_object.script index 33236f51..51252210 100644 --- a/gamedata/scripts/bind_physic_object.script +++ b/gamedata/scripts/bind_physic_object.script @@ -104,11 +104,11 @@ function generic_physics_binder:update(delta) -- called 6th end end + xr_sound.update(obj:id()) -- DC20231015 + if obj_st.active_scheme then xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta) end - - xr_sound.update(obj:id()) end -------------------------------------------------------------------------------- diff --git a/gamedata/scripts/bind_restrictor.script b/gamedata/scripts/bind_restrictor.script index 34ef4dff..f3422a5b 100644 --- a/gamedata/scripts/bind_restrictor.script +++ b/gamedata/scripts/bind_restrictor.script @@ -90,11 +90,16 @@ function restrictor_binder:update(delta) -- called 6th xr_logic.initialize_obj(self.object, obj_st, self.loaded, modules.stype_restrictor) end + -- DC20231015: Per https://github.com/Decane/SRP/issues/154, the xr_sound update must precede + -- the active scheme update to prevent time windows wherein the game can be saved in a state + -- where a sound_end/theme_end signal has been registered in scheme storage but not yet + -- processed to trigger a section switch (which would only happen on the subsequent update). + + xr_sound.update(self.object:id()) + if obj_st.active_scheme then xr_logic.issue_event(nil, obj_st[obj_st.active_scheme], "update", delta) end - - xr_sound.update(self.object:id()) end -------------------------------------------------------------------------------- diff --git a/gamedata/scripts/xr_motivator.script b/gamedata/scripts/xr_motivator.script index 33d95fa7..bdb38140 100644 --- a/gamedata/scripts/xr_motivator.script +++ b/gamedata/scripts/xr_motivator.script @@ -259,6 +259,10 @@ function motivator_binder:update(delta) -- called 6th if npc_alive then + local npc_id = npc:id() + + xr_sound.update(npc_id) -- DC20231015 + if npc_st.active_scheme then local need_switch = true local manager = npc:motivation_action_manager() @@ -282,10 +286,6 @@ function motivator_binder:update(delta) -- called 6th npc_st.active_sector = sr_danger.select_active_sectors(npc) npc_st.state_mgr:update() - local npc_id = npc:id() - - xr_sound.update(npc_id) - local squad = npc_st.squad_obj if squad and squad.commander_id == npc_id then