noita_entangled_worlds/files/append/gun.lua

33 lines
1,018 B
Lua
Raw Normal View History

2024-05-12 15:31:08 +03:00
local old_order_deck = order_deck
order_deck = function()
local oldSetRandomSeed = SetRandomSeed
2024-05-15 16:50:59 +03:00
SetRandomSeed = function()
2024-05-12 15:31:08 +03:00
local shooter = EntityGetRootEntity(GetUpdatedEntityID())
--GamePrint(EntityGetName(shooter))
oldSetRandomSeed(GameGetFrameNum(), GameGetFrameNum())
local seed = 0
if(EntityHasTag(shooter, "ew_client"))then
2024-05-15 16:50:59 +03:00
-- GamePrint("2: ew_shooter_rng_"..EntityGetName(shooter))
-- GamePrint(GlobalsGetValue("ew_shooter_rng_"..EntityGetName(shooter), "0"))
2024-05-12 15:31:08 +03:00
seed = tonumber(GlobalsGetValue("ew_shooter_rng_"..EntityGetName(shooter), "0")) or 0
elseif(EntityHasTag(shooter, "player_unit"))then
seed = Random(10, 10000000)
GlobalsSetValue("ew_player_rng", tostring(seed))
2024-05-15 16:50:59 +03:00
-- GamePrint(tostring(seed))
2024-05-12 15:31:08 +03:00
end
oldSetRandomSeed(seed, seed)
end
SetRandomSeed()
old_order_deck()
SetRandomSeed = oldSetRandomSeed
end