fix camera being sent to 0,0 on end fight death

This commit is contained in:
bgkillas 2024-10-11 17:10:44 -04:00
parent e73dbc9f02
commit e8e1343244
2 changed files with 19 additions and 14 deletions

View file

@ -384,13 +384,13 @@ function inventory_helper.set_item_data(item_data, player_data)
np.SetActiveHeldEntity(player, active_item_entity, false, false)
end
end
local inventory2Comp = EntityGetFirstComponentIncludingDisabled(player, "Inventory2Component")
if inventory2Comp ~= nil then
async(function()
wait(1)
async(function()
wait(1)
local inventory2Comp = EntityGetFirstComponentIncludingDisabled(player, "Inventory2Component")
if inventory2Comp ~= nil then
ComponentSetValue2(inventory2Comp, "mForceRefresh", true)
end)
end
end
end)
end
function inventory_helper.has_inventory_changed(player_data)

View file

@ -172,18 +172,23 @@ local function player_died()
end
local function do_game_over(message)
GameSetCameraFree(false)
net.proxy_notify_game_over()
ctx.run_ended = true
GameRemoveFlagRun("ew_flag_notplayer_active")
ctx.my_player.entity = end_poly_effect(ctx.my_player.entity)
local damage_model = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
if damage_model ~= nil then
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", false)
EntityInflictDamage(ctx.my_player.entity, 1000000, "DAMAGE_CURSE", message, "NONE", 0, 0, GameGetWorldStateEntity())
GameRemoveFlagRun("ew_flag_notplayer_active")
if damage_model ~= nil and #EntityGetAllChildren(ctx.my_player.entity) ~= 0 then
GameSetCameraFree(false)
ctx.my_player.entity = end_poly_effect(ctx.my_player.entity)
if ctx.my_player.entity ~= nil then
ComponentSetValue2(damage_model, "wait_for_kill_flag_on_death", false)
EntityInflictDamage(ctx.my_player.entity, 1000000, "DAMAGE_CURSE", message, "NONE", 0, 0, GameGetWorldStateEntity())
GameTriggerGameOver()
EntityKill(ctx.my_player.entity)
end
else
GameSetCameraFree(true)
GameTriggerGameOver()
end
GameTriggerGameOver()
EntityKill(ctx.my_player.entity)
end
function module.on_local_player_spawn(my_player)