2024-05-12 15:31:08 +03:00
|
|
|
|
|
|
|
-- loop backwards through perk_list so we can remove entries
|
|
|
|
for i=#actions,1,-1 do
|
|
|
|
local action = actions[i]
|
|
|
|
|
|
|
|
local func = action.action
|
|
|
|
action.action = function(...)
|
2024-08-21 23:48:32 +03:00
|
|
|
if reflecting then
|
2024-05-12 15:31:08 +03:00
|
|
|
func(...)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local oldSetRandomSeed = SetRandomSeed
|
|
|
|
|
|
|
|
local shooter = EntityGetRootEntity(GetUpdatedEntityID())
|
|
|
|
local x, y = EntityGetTransform(GetUpdatedEntityID())
|
|
|
|
|
2024-08-21 23:48:32 +03:00
|
|
|
local seed = math.floor(x * y + GameGetFrameNum())
|
2024-05-12 15:31:08 +03:00
|
|
|
|
2024-08-21 23:48:32 +03:00
|
|
|
if EntityHasTag(shooter, "ew_client") then
|
2024-05-12 15:31:08 +03:00
|
|
|
seed = tonumber(GlobalsGetValue("ew_action_rng_"..EntityGetName(shooter), "0")) or 0
|
|
|
|
else
|
2024-08-21 23:48:32 +03:00
|
|
|
if GlobalsGetValue("ew_player_action_rng", "0") ~= "0" then
|
2024-05-12 15:31:08 +03:00
|
|
|
seed = tonumber(GlobalsGetValue("ew_player_action_rng", "0"))
|
|
|
|
else
|
|
|
|
GlobalsSetValue("ew_player_action_rng", tostring(seed))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-08-21 23:48:32 +03:00
|
|
|
SetRandomSeed = function()
|
2024-05-12 15:31:08 +03:00
|
|
|
oldSetRandomSeed(seed, seed)
|
|
|
|
end
|
|
|
|
|
|
|
|
func(...)
|
|
|
|
|
|
|
|
SetRandomSeed = oldSetRandomSeed
|
|
|
|
end
|
|
|
|
|
2024-10-14 08:13:47 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
local orig = GetUpdatedEntityID
|
|
|
|
|
|
|
|
function GetUpdatedEntityID()
|
2024-10-14 08:19:55 -04:00
|
|
|
local ent = EntityGetRootEntity(orig())
|
|
|
|
return ent
|
2024-05-12 15:31:08 +03:00
|
|
|
end
|