mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Extra check in local_health
This commit is contained in:
parent
4e5b1aaf7e
commit
a19dc7d165
2 changed files with 10 additions and 1 deletions
|
@ -290,16 +290,21 @@ function util.log(...)
|
||||||
if ctx.proxy_opt.debug then
|
if ctx.proxy_opt.debug then
|
||||||
GamePrint(...)
|
GamePrint(...)
|
||||||
end
|
end
|
||||||
|
print(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.serialize_entity(ent)
|
function util.serialize_entity(ent)
|
||||||
-- Serialized entities usually get sent to other clients, and it's a very bad idea to try and send them another WorldState.
|
-- Serialized entities usually get sent to other clients, and it's a very bad idea to try and send them another WorldState.
|
||||||
if EntityHasTag(ent, "world_state") or EntityGetFirstComponentIncludingDisabled(ent, "WorldStateComponent") ~= nil then
|
if util.is_world_state_entity_like(ent) then
|
||||||
error("Tried to serialize WorldStateEntity")
|
error("Tried to serialize WorldStateEntity")
|
||||||
end
|
end
|
||||||
return np.SerializeEntity(ent)
|
return np.SerializeEntity(ent)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function util.is_world_state_entity_like(ent)
|
||||||
|
return EntityHasTag(ent, "world_state") or EntityGetFirstComponentIncludingDisabled(ent, "WorldStateComponent") ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
function util.deserialize_entity(ent_data, x, y)
|
function util.deserialize_entity(ent_data, x, y)
|
||||||
local ent = EntityCreateNew()
|
local ent = EntityCreateNew()
|
||||||
if x == nil or y == nil then
|
if x == nil or y == nil then
|
||||||
|
|
|
@ -167,6 +167,10 @@ local function player_died()
|
||||||
if ctx.my_player.entity == nil then
|
if ctx.my_player.entity == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if util.is_world_state_entity_like(ctx.my_player.entity) then
|
||||||
|
util.log("Err: Current player is world state like.")
|
||||||
|
return
|
||||||
|
end
|
||||||
rpc.remove_homing(false)
|
rpc.remove_homing(false)
|
||||||
-- Serialize inventory, perks, and max_hp, we'll need to copy it over to notplayer.
|
-- Serialize inventory, perks, and max_hp, we'll need to copy it over to notplayer.
|
||||||
local item_data = inventory_helper.get_item_data(ctx.my_player)
|
local item_data = inventory_helper.get_item_data(ctx.my_player)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue