remove status effects on final death a bit better, fix error

This commit is contained in:
bgkillas 2024-09-29 21:51:49 -04:00
parent f73f4bb4cf
commit 5a27664c2a
3 changed files with 34 additions and 2 deletions

View file

@ -6,6 +6,9 @@ local init = -1
local done = false
local kill_walls = false
local rpc = net.new_rpc_namespace()
dofile_once("data/scripts/status_effects/status_list.lua")
local status_effects = status_effects
ModTextFileSetContent("data/entities/animals/boss_centipede/ending/gold_effect.xml", "<Entity/>")
ModTextFileSetContent("data/entities/animals/boss_centipede/ending/midas_sand.xml", "<Entity/>")
@ -130,6 +133,17 @@ function end_fight.on_world_update()
for _, child in ipairs(EntityGetAllChildren(entity) or {}) do
EntityKill(child)
end
for _, effect in pairs(status_effects) do
if EntityGetIsAlive(entity) then
EntityRemoveStainStatusEffect(entity, effect.id)
EntityRemoveIngestionStatusEffect(entity, effect.id)
end
end
local damage_model = EntityGetFirstComponentIncludingDisabled(entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "mFireProbability", 0)
ComponentSetValue2(damage_model, "mFireFramesLeft", 0)
end
end)
end
::continue::

View file

@ -11,6 +11,8 @@ local rpc = net.new_rpc_namespace()
dofile_once("data/scripts/status_effects/status_list.lua")
local status_effects = status_effects
local module = {}
function module.on_player_died(player_entity)
@ -257,7 +259,6 @@ ctx.cap.health = {
remove_inventory()
GameRemoveFlagRun("ew_flag_notplayer_active")
end_poly_effect(ctx.my_player.entity)
local status_effects = status_effects
async(function ()
wait(1)
for _, child in pairs(EntityGetAllChildren(ctx.my_player.entity) or {}) do
@ -274,6 +275,11 @@ ctx.cap.health = {
EntityRemoveIngestionStatusEffect(ctx.my_player.entity, effect.id)
end
end
local damage_model = EntityGetFirstComponentIncludingDisabled(entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "mFireProbability", 0)
ComponentSetValue2(damage_model, "mFireFramesLeft", 0)
end
inventory_helper.set_item_data(item_data, ctx.my_player)
remove_inventory_tags()
local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent")
@ -317,6 +323,17 @@ function rpc.trigger_game_over(message)
for _, child in ipairs(EntityGetAllChildren(entity) or {}) do
EntityKill(child)
end
for _, effect in pairs(status_effects) do
if EntityGetIsAlive(entity) then
EntityRemoveStainStatusEffect(entity, effect.id)
EntityRemoveIngestionStatusEffect(entity, effect.id)
end
end
local damage_model = EntityGetFirstComponentIncludingDisabled(entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "mFireProbability", 0)
ComponentSetValue2(damage_model, "mFireFramesLeft", 0)
end
end
end
end

View file

@ -1 +1,2 @@
ModLuaFileAppend("data/scripts/gun/gun.lua", "mods/quant.ew/files/system/remove_wand_sound/remove_sound.lua")
ModLuaFileAppend("data/scripts/gun/gun.lua", "mods/quant.ew/files/system/remove_wand_sound/remove_sound.lua")
return {}