sync stevari spawns better, fix notplayer not being able to throw potions

This commit is contained in:
bgkillas 2024-10-12 16:49:57 -04:00
parent 164cdabb76
commit 7ef85b973c
4 changed files with 36 additions and 1 deletions

View file

@ -159,7 +159,6 @@ local function player_died()
set_cosmetics_locally(ctx.my_id)
polymorph.switch_entity(ent + 1)
remove_inventory_tags()
remove_healthbar_locally()
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
if EntityGetName(child) == "cursor" or EntityGetName(child) == "notcursor" then
@ -167,6 +166,7 @@ local function player_died()
end
end
inventory_helper.set_item_data(item_data, ctx.my_player)
remove_inventory_tags()
perk_fns.update_perks_for_entity(perk_data, ctx.my_player.entity, allow_notplayer_perk)
rpc.add_nickname_change_cursor()
end

View file

@ -0,0 +1,5 @@
function temple_spawn_guardian( pos_x, pos_y )
if CrossCall("ew_is_host") then
CrossCall("ew_spawn_stevari", pos_x, pos_y)
end
end

View file

@ -0,0 +1,29 @@
local rpc = net.new_rpc_namespace()
ModLuaFileAppend("data/scripts/biomes/temple_shared.lua", "mods/quant.ew/files/system/stevari/append.lua")
np.CrossCallAdd("ew_is_host", function()
return ctx.is_host
end)
rpc.opts_everywhere()
function rpc.spawn_stevari(pos_x, pos_y)
if( GlobalsGetValue( "TEMPLE_PEACE_WITH_GODS" ) == "1" ) then
return
end
local guard_spawn_id = EntityGetClosestWithTag( pos_x, pos_y, "guardian_spawn_pos" )
local guard_x = pos_x
local guard_y = pos_y
if( guard_spawn_id ~= 0 ) then
guard_x, guard_y = EntityGetTransform( guard_spawn_id )
EntityKill( guard_spawn_id )
end
EntityLoad( "data/entities/misc/spawn_necromancer_shop.xml", guard_x, guard_y )
end
np.CrossCallAdd("ew_spawn_stevari", function(x, y)
rpc.spawn_stevari(x, y)
end)

View file

@ -117,6 +117,7 @@ local function load_modules()
ctx.load_system("random_start")
ctx.load_system("worms")
ctx.load_system("wand_charm")
ctx.load_system("stevari")
end
local function load_extra_modules()