mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
make rng better in theory, maybe fix orbs duplicating
This commit is contained in:
parent
f732d8f2b7
commit
6d194a2b78
8 changed files with 18 additions and 19 deletions
|
@ -30,7 +30,8 @@ end
|
|||
|
||||
local entity_id = GetUpdatedEntityID()
|
||||
local x, y = EntityGetTransform( entity_id )
|
||||
SetRandomSeed( x-1 - CrossCall("ew_per_peer_seed"), y + CrossCall("ew_per_peer_seed"))
|
||||
local sx, sy = CrossCall("ew_per_peer_seed")
|
||||
SetRandomSeed( x + 19 - sx, y - 19 + sy)
|
||||
|
||||
local ability_comp = EntityGetFirstComponent( entity_id, "AbilityComponent" )
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ end
|
|||
|
||||
local entity_id = GetUpdatedEntityID()
|
||||
local x, y = EntityGetTransform( entity_id )
|
||||
SetRandomSeed( x - CrossCall("ew_per_peer_seed"), y + CrossCall("ew_per_peer_seed"))
|
||||
local sx, sy = CrossCall("ew_per_peer_seed")
|
||||
SetRandomSeed( x + sx - CrossCall("ew_per_peer_seed"), y - 34 + sy)
|
||||
|
||||
local ability_comp = EntityGetFirstComponent( entity_id, "AbilityComponent" )
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ end
|
|||
|
||||
local entity_id = GetUpdatedEntityID()
|
||||
local x, y = EntityGetTransform( entity_id )
|
||||
SetRandomSeed( x - CrossCall("ew_per_peer_seed"), y-11 + CrossCall("ew_per_peer_seed"))
|
||||
local sx, sy = CrossCall("ew_per_peer_seed")
|
||||
SetRandomSeed( x + 4 - sx, y-11 + sy)
|
||||
|
||||
local ability_comp = EntityGetFirstComponent( entity_id, "AbilityComponent" )
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ end
|
|||
|
||||
local entity_id = GetUpdatedEntityID()
|
||||
local x, y = EntityGetTransform( entity_id )
|
||||
SetRandomSeed( x - CrossCall("ew_per_peer_seed"), y + CrossCall("ew_per_peer_seed"))
|
||||
local sx, sy = CrossCall("ew_per_peer_seed")
|
||||
SetRandomSeed( x - 72 - sx, y + 72 + sy)
|
||||
|
||||
local ability_comp = EntityGetFirstComponent( entity_id, "AbilityComponent" )
|
||||
|
||||
|
|
|
@ -36,7 +36,10 @@ local function actual_orbs_update(found_orbs)
|
|||
last_orb_count = GameGetOrbCountThisRun()
|
||||
end
|
||||
|
||||
function rpc.update_orbs(found_orbs)
|
||||
function rpc.update_orbs(found_orbs, to_host)
|
||||
if to_host and ctx.my_id ~= ctx.host_id then
|
||||
return
|
||||
end
|
||||
if EntityHasTag(ctx.my_player.entity, "polymorphed") then
|
||||
wait_for_these = found_orbs
|
||||
return
|
||||
|
@ -44,10 +47,6 @@ function rpc.update_orbs(found_orbs)
|
|||
actual_orbs_update(found_orbs)
|
||||
end
|
||||
|
||||
local function send_orbs()
|
||||
rpc.update_orbs(orbs_found_this_run())
|
||||
end
|
||||
|
||||
function module.on_world_update()
|
||||
if GameGetFrameNum() % 3 == 0 then
|
||||
local found_local = orbs_found_this_run()
|
||||
|
@ -66,13 +65,7 @@ function module.on_world_update()
|
|||
wait_for_these = nil
|
||||
elseif last_orb_count ~= GameGetOrbCountThisRun() then
|
||||
last_orb_count = GameGetOrbCountThisRun()
|
||||
send_orbs()
|
||||
end
|
||||
end
|
||||
|
||||
function module.on_should_send_updates()
|
||||
if ctx.is_host then
|
||||
send_orbs()
|
||||
rpc.update_orbs(orbs_found_this_run(), ctx.my_id ~= ctx.host_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
local orig_potion = potion_a_materials
|
||||
|
||||
function potion_a_materials()
|
||||
SetRandomSeed(4, -2 + CrossCall("ew_per_peer_seed"))
|
||||
local sx, sy = CrossCall("ew_per_peer_seed")
|
||||
SetRandomSeed(4 + sx, -2 + sy)
|
||||
local orig_SetRandomSeed = SetRandomSeed
|
||||
function SetRandomSeed(x, y) end
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
local orig_perk_get_spawn_order = perk_get_spawn_order
|
||||
|
||||
function perk_get_spawn_order( ignore_these_ )
|
||||
SetRandomSeed(1, 2 + CrossCall("ew_per_peer_seed"))
|
||||
local sx, sy = CrossCall("ew_per_peer_seed")
|
||||
SetRandomSeed(1 + sx, 2 + sy)
|
||||
local orig_SetRandomSeed = SetRandomSeed
|
||||
function SetRandomSeed(x, y) end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ ModLuaFileAppend("data/scripts/gun/gun_actions.lua", "mods/quant.ew/files/resour
|
|||
ModMagicNumbersFileAdd("mods/quant.ew/files/magic.xml")
|
||||
|
||||
np.CrossCallAdd("ew_per_peer_seed", function()
|
||||
return tonumber(string.sub(ctx.my_id, 9), 16)
|
||||
return tonumber(string.sub(ctx.my_id, 8, 12), 16), tonumber(string.sub(ctx.my_id, 12), 16)
|
||||
end)
|
||||
|
||||
local function load_modules()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue