fix end fight crash, fully fix end fight camera tp to 0,0 i hope, put out fire on player when end fight starts,

This commit is contained in:
bgkillas 2024-10-11 20:25:24 -04:00
parent 8d8859b1bd
commit 0f55a96df4
4 changed files with 78 additions and 63 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ save_state
*png~
/quant.ew/files/system/player/tmp/
/quant.ew/ewext.dll
/quant.ew/ewext0.dll

Binary file not shown.

View file

@ -52,6 +52,20 @@ rpc.opts_everywhere()
function rpc.try_kill(x, y)
EntityLoad("mods/quant.ew/files/system/end_fight/gold_effect.xml", x, y )
done = true
async(function()
wait(180)
if not ctx.run_ended then
GameTriggerGameOver()
end
end)
end
local function remove_fire(entity)
local damage_model = EntityGetFirstComponentIncludingDisabled(entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "mFireProbability", 0)
ComponentSetValue2(damage_model, "mFireFramesLeft", 0)
end
end
local function remove_status(entity, little)
@ -66,11 +80,7 @@ local function remove_status(entity, little)
end
end
end
local damage_model = EntityGetFirstComponentIncludingDisabled(entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "mFireProbability", 0)
ComponentSetValue2(damage_model, "mFireFramesLeft", 0)
end
remove_fire(entity)
end
local function remove_game_effects()
@ -84,7 +94,8 @@ local function remove_game_effects()
end
function end_fight.on_world_update()
if GameHasFlagRun("ending_game_completed") and not done then
if GameHasFlagRun("ending_game_completed") then
if not done then
if kill_walls == GameGetFrameNum() then
for _, entity in pairs(EntityGetInRadius(6400, 15155, 100) or {}) do
if EntityGetFilename(entity) == "data/entities/animals/boss_centipede/ending/midas_walls.xml" then
@ -106,6 +117,7 @@ function end_fight.on_world_update()
first = false
init = GameGetFrameNum() + 10
teleport_random()
remove_fire(ctx.my_player.entity)
LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/local_health/notplayer/safe_effect2.xml")
kill_walls = GameGetFrameNum() + 180
elseif init < GameGetFrameNum() and GameGetFrameNum() % 10 == 0 then
@ -120,11 +132,6 @@ function end_fight.on_world_update()
if try_kill <= GameGetFrameNum() and try_kill ~= -1 then
local x, y = EntityGetTransform(ctx.my_player.entity)
rpc.try_kill(x, y)
done = true
async(function()
wait(100)
GameTriggerGameOver()
end)
return
elseif try_kill == -1 then
try_kill = GameGetFrameNum() + 60
@ -133,7 +140,8 @@ function end_fight.on_world_update()
try_kill = -1
end
end
if GameGetFrameNum() % 5 ~= 0 then
end
if GameGetFrameNum() % 3 ~= 0 then
return
end
for _, player_data in pairs(ctx.players) do
@ -175,8 +183,10 @@ 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

@ -176,7 +176,7 @@ local function do_game_over(message)
ctx.run_ended = true
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
GameRemoveFlagRun("ew_flag_notplayer_active")
if damage_model ~= nil and #EntityGetAllChildren(ctx.my_player.entity) ~= 0 then
if damage_model ~= nil and #(EntityGetAllChildren(ctx.my_player.entity) or {}) ~= 0 then
GameSetCameraFree(false)
ctx.my_player.entity = end_poly_effect(ctx.my_player.entity)
if ctx.my_player.entity ~= nil then
@ -309,12 +309,14 @@ ctx.cap.health = {
end
end
end
if not ctx.run_ended then
for _, effect in pairs(status_effects) do
if EntityGetIsAlive(ctx.my_player.entity) then
EntityRemoveStainStatusEffect(ctx.my_player.entity, effect.id)
EntityRemoveIngestionStatusEffect(ctx.my_player.entity, effect.id)
end
end
end
local damage_model = EntityGetFirstComponentIncludingDisabled(entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "mFireProbability", 0)
@ -369,12 +371,14 @@ function rpc.trigger_game_over(message)
for _, child in ipairs(EntityGetAllChildren(entity) or {}) do
EntityKill(child)
end
if not ctx.run_ended then
for _, effect in pairs(status_effects) do
if EntityGetIsAlive(entity) then
EntityRemoveStainStatusEffect(entity, effect.id)
EntityRemoveIngestionStatusEffect(entity, effect.id)
end
end
end
local damage_model = EntityGetFirstComponentIncludingDisabled(entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "mFireProbability", 0)