Fix having different seeds in gun actions.

This commit is contained in:
IQuant 2024-08-21 23:48:32 +03:00
parent 766cfb6b91
commit f657f811a5

View file

@ -5,7 +5,7 @@ for i=#actions,1,-1 do
local func = action.action
action.action = function(...)
if(reflecting)then
if reflecting then
func(...)
return
end
@ -15,13 +15,12 @@ for i=#actions,1,-1 do
local shooter = EntityGetRootEntity(GetUpdatedEntityID())
local x, y = EntityGetTransform(GetUpdatedEntityID())
local seed = x * y + GameGetFrameNum()
local seed = math.floor(x * y + GameGetFrameNum())
if(EntityHasTag(shooter, "ew_client"))then
--GamePrint("2: shooter_rng_"..EntityGetName(shooter))
if EntityHasTag(shooter, "ew_client") then
seed = tonumber(GlobalsGetValue("ew_action_rng_"..EntityGetName(shooter), "0")) or 0
else
if(GlobalsGetValue("ew_player_action_rng", "0") ~= "0")then
if GlobalsGetValue("ew_player_action_rng", "0") ~= "0" then
seed = tonumber(GlobalsGetValue("ew_player_action_rng", "0"))
else
GlobalsSetValue("ew_player_action_rng", tostring(seed))
@ -34,8 +33,6 @@ for i=#actions,1,-1 do
func(...)
SetRandomSeed = oldSetRandomSeed
end