fix crash after end fight

This commit is contained in:
bgkillas 2024-10-12 16:24:52 -04:00
parent 625ff4195c
commit 164cdabb76
2 changed files with 6 additions and 5 deletions

View file

@ -69,6 +69,9 @@ local function remove_fire(entity)
end
local function remove_status(entity, little)
if EntityGetFirstComponent(entity, "StatusEffectDataComponent") == nil then
return
end
if little then
EntityRemoveStainStatusEffect(entity, status_effects[24].id)
EntityRemoveIngestionStatusEffect(entity, status_effects[24].id)
@ -183,10 +186,8 @@ function end_fight.on_world_update()
for _, child in ipairs(EntityGetAllChildren(entity) or {}) do
EntityKill(child)
end
if not ctx.run_ended then
remove_status(entity)
end
end
::continue::
end
end

View file

@ -309,7 +309,7 @@ ctx.cap.health = {
end
end
end
if not ctx.run_ended then
if EntityGetFirstComponent(ctx.my_player.entity, "StatusEffectDataComponent") ~= nil then
for _, effect in pairs(status_effects) do
if EntityGetIsAlive(ctx.my_player.entity) then
EntityRemoveStainStatusEffect(ctx.my_player.entity, effect.id)
@ -375,7 +375,7 @@ function rpc.trigger_game_over(message)
for _, child in ipairs(EntityGetAllChildren(entity) or {}) do
EntityKill(child)
end
if not ctx.run_ended then
if EntityGetFirstComponent(entity, "StatusEffectDataComponent") ~= nil then
for _, effect in pairs(status_effects) do
if EntityGetIsAlive(entity) then
EntityRemoveStainStatusEffect(entity, effect.id)