mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
fix poly deleting your entity
This commit is contained in:
parent
517743a72e
commit
7e67345b48
3 changed files with 11 additions and 8 deletions
|
@ -172,14 +172,16 @@ local function get_sync_entities(return_all)
|
|||
|
||||
local entities2 = {}
|
||||
if return_all then
|
||||
entities2 = entities
|
||||
table_extend_filtered(entities2, entities, function(ent)
|
||||
return not EntityHasTag(ent, "ew_no_enemy_sync")
|
||||
end)
|
||||
else
|
||||
table_extend_filtered(entities2, entities, function(ent)
|
||||
local x, y = EntityGetTransform(ent)
|
||||
local has_anyone = EntityHasTag(ent, "worm")
|
||||
or EntityGetFirstComponent(ent, "BossHealthBarComponent") ~= nil
|
||||
or #EntityGetInRadiusWithTag(x, y, DISTANCE_LIMIT, "ew_peer") ~= 0
|
||||
return has_anyone
|
||||
return has_anyone and not EntityHasTag(ent, "ew_no_enemy_sync")
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ local function player_died()
|
|||
-- This may look like a hack, but it allows to use existing poly machinery to change player entity AND to store the original player for later,
|
||||
-- Which is, like, perfect.
|
||||
local ent = LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/local_health/notplayer/poly_effect.xml")
|
||||
polymorph.switch_entity(ent + 1)
|
||||
ctx.my_player.entity = ent + 1
|
||||
GameAddFlagRun("ew_flag_notplayer_active")
|
||||
do_switch_effect(false)
|
||||
EntitySetName(ctx.my_player.entity, ctx.my_id.."?")
|
||||
|
@ -154,6 +154,7 @@ local function player_died()
|
|||
EntityAddTag(iron, "kill_on_revive")
|
||||
LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/spectate/no_tinker.xml")
|
||||
set_cosmetics_locally(ctx.my_id)
|
||||
polymorph.switch_entity(ent + 1)
|
||||
|
||||
remove_healthbar_locally()
|
||||
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
||||
|
@ -304,8 +305,7 @@ ctx.cap.health = {
|
|||
local item_data = inventory_helper.get_item_data(ctx.my_player)
|
||||
remove_inventory()
|
||||
GameRemoveFlagRun("ew_flag_notplayer_active")
|
||||
local ent = end_poly_effect(ctx.my_player.entity)
|
||||
polymorph.switch_entity(ent)
|
||||
ctx.my_player.entity = end_poly_effect(ctx.my_player.entity)
|
||||
for _, child in ipairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
|
||||
if not EntityHasTag(child, "perk_entity") then
|
||||
local com = EntityGetFirstComponentIncludingDisabled(child, "GameEffectComponent")
|
||||
|
@ -339,6 +339,7 @@ ctx.cap.health = {
|
|||
end
|
||||
if GameHasFlagRun("ew_kill_player") then
|
||||
GameRemoveFlagRun("ew_kill_player")
|
||||
polymorph.switch_entity(ctx.my_player.entity)
|
||||
async(function()
|
||||
wait(1)
|
||||
if GameHasFlagRun("ending_game_completed") then
|
||||
|
@ -349,10 +350,10 @@ ctx.cap.health = {
|
|||
end)
|
||||
else
|
||||
do_switch_effect(true)
|
||||
polymorph.switch_entity(ctx.my_player.entity)
|
||||
end
|
||||
else
|
||||
local ent = end_poly_effect(ctx.my_player.entity)
|
||||
polymorph.switch_entity(ent)
|
||||
polymorph.switch_entity(end_poly_effect(ctx.my_player.entity))
|
||||
async(function()
|
||||
wait(1)
|
||||
player_died()
|
||||
|
|
|
@ -14,7 +14,7 @@ function rpc.player_update(input_data, pos_data, current_slot, team)
|
|||
end
|
||||
local player_data = player_fns.peer_get_player_data(peer_id)
|
||||
|
||||
if team ~= nil and not GameHasFlagRun("ending_game_completed") and not EntityHasTag(player_data.entity, "ew_notplayer") and ctx.proxy_opt.friendly_fire_team ~= nil then
|
||||
if team ~= nil and not GameHasFlagRun("ending_game_completed") and not EntityHasTag(player_data.entity, "polymorphed") and ctx.proxy_opt.friendly_fire_team ~= nil then
|
||||
local my_team = ctx.proxy_opt.friendly_fire_team - 1
|
||||
if my_team ~= -1 and team ~= -1 and (team == 0 or my_team == 0 or team ~= my_team) then
|
||||
GenomeSetHerdId(player_data.entity, "player_pvp")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue