Skip to content

Commit

Permalink
Fixed NPC wounded start time being saved incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
Decane committed Feb 18, 2023
1 parent 7d89f09 commit c6077bf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions SRP v1.1.4 - Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ Gameplay fixes:
+ Fixed the issue where squad info tooltips would fail to update properly and would, consequently, sometimes display the wrong target location.
+ Fixed several bugs pertaining to the displaying of squad map spots, including the issue where its color would react sluggishly to relationship changes to the player.
+ Mitigated the issue where the weather would sometimes inexplicably change after loading.
+ Fixed the start time for NPCs' heavily wounded state being saved incorrectly.
+ Fixed PSI emission hit and effector intensity doubling on save/reload.
+ Fixed the issue where crows could get stuck floating in the air upon being shot.
+ Fixed the "Life support system" upgrade for the Freedom Exoskeleton making the player bleed out faster rather than slower as intended.
Expand Down
1 change: 1 addition & 0 deletions SRP v1.1.4 - Version History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ v1.1.4
+ Fixed the game crashing if a stalker squad at a smart terrain has it as a scripted target and is joined by another squad that doesn't and the general job capacity of that smart terrain is saturated by the two squads. - Decane
+ 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 the start time for NPCs' heavily wounded state being saved incorrectly. - Decane
+ Mitigated the issue where the weather would sometimes inexplicably change after loading. - Decane
+ Mitigated the issue where the player's character model would revert back to the default rookie jacket model upon picking up another suit of armor. - Artos, Shoker
+ Fixed the issue where the player would be rejected from playing the shooting minigame if their money precisely matches the entry fee instead of exceeding it. - Decane
Expand Down
7 changes: 7 additions & 0 deletions gamedata/scripts/xr_logic.script
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,13 @@ function pstor_retrieve(obj, varname, defval)
return defval
end

function pstor_clear(obj, varname)
local npc_st = db_storage[obj:id()]
if npc_st.pstor ~= nil then
npc_st.pstor[varname] = nil
end
end

function pstor_save_all(obj, packet)

local obj_st = db_storage[obj:id()]
Expand Down
5 changes: 3 additions & 2 deletions gamedata/scripts/xr_wounded.script
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ function action_wounded:execute()

if self.a.autoheal and not wound_manager.can_use_medkit then
local begin_wounded = xr_logic.pstor_retrieve(self.object, "begin_wounded")
local current_time = time_global()
local current_time = game.time()
if begin_wounded == nil then
xr_logic.pstor_store(self.object, "begin_wounded", current_time)
elseif current_time - begin_wounded > 60000 then
elseif current_time - begin_wounded > 60000 * level.get_time_factor() then -- 60 real seconds in-game
local npc = self.object
_G.sim:create("medkit", npc:position(), npc:level_vertex_id(), npc:game_vertex_id(), npc:id())
wound_manager:unlock_medkit()
Expand Down Expand Up @@ -164,6 +164,7 @@ function action_wounded:finalize()
--' xr_sound.set_sound(self.object, nil)
self.object:wounded(false)
self.object:movement_enabled(true)
xr_logic.pstor_clear(self.object, "begin_wounded")
end

--------------------------------------------------------------------------------
Expand Down

0 comments on commit c6077bf

Please sign in to comment.