mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
42 lines
1.2 KiB
Lua
42 lines
1.2 KiB
Lua
![]() |
|
||
|
-- 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(...)
|
||
|
if(reflecting)then
|
||
|
func(...)
|
||
|
return
|
||
|
end
|
||
|
|
||
|
local oldSetRandomSeed = SetRandomSeed
|
||
|
|
||
|
local shooter = EntityGetRootEntity(GetUpdatedEntityID())
|
||
|
local x, y = EntityGetTransform(GetUpdatedEntityID())
|
||
|
|
||
|
local seed = x * y + GameGetFrameNum()
|
||
|
|
||
|
if(EntityHasTag(shooter, "ew_client"))then
|
||
|
--GamePrint("2: shooter_rng_"..EntityGetName(shooter))
|
||
|
seed = tonumber(GlobalsGetValue("ew_action_rng_"..EntityGetName(shooter), "0")) or 0
|
||
|
else
|
||
|
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))
|
||
|
end
|
||
|
end
|
||
|
|
||
|
SetRandomSeed = function()
|
||
|
oldSetRandomSeed(seed, seed)
|
||
|
end
|
||
|
|
||
|
func(...)
|
||
|
|
||
|
|
||
|
|
||
|
SetRandomSeed = oldSetRandomSeed
|
||
|
end
|
||
|
|
||
|
end
|