From 5e5a249cce1221db032f610057ab986443477d62 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 27 Jan 2022 06:52:59 +0000 Subject: titan cleanup stability improvements --- .../mod/scripts/vscripts/mp/_base_gametype_mp.gnut | 13 +++++++++---- .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 12 +++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts/vscripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut index b169de63..feca3bd5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -318,11 +318,11 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga else player.SetObserverTarget( null ) - if ( !file.playerDeathsHidden ) - { + if ( ( GamePlayingOrSuddenDeath() || GetGameState() == eGameState.Epilogue ) && !file.playerDeathsHidden ) player.AddToPlayerGameStat( PGS_DEATHS, 1 ) + + if ( !file.playerDeathsHidden ) Remote_CallFunction_NonReplay( player, "ServerCallback_YouDied", attacker.GetEncodedEHandle(), GetHealthFrac( attacker ), methodOfDeath ) - } float deathcamLength = GetDeathCamLength( player ) wait deathcamLength @@ -460,6 +460,7 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) camera.Fire( "Enable", "!activator", 0, player ) player.EndSignal( "OnDestroy" ) + titan.EndSignal( "OnDestroy" ) OnThreadEnd( function() : ( player, titan, camera ) { if ( IsValid( player ) ) @@ -468,7 +469,11 @@ void function RespawnAsTitan( entity player, bool manualPosition = false ) player.isSpawning = false } - titan.Destroy() // pilotbecomestitan leaves an npc titan that we need to delete + if ( IsValid( titan ) ) + titan.Destroy() // pilotbecomestitan leaves an npc titan that we need to delete + else + RespawnAsPilot( player ) // this is 100% an edgecase, just avoid softlocking if we ever hit it in playable gamestates + camera.Fire( "Disable", "!activator", 0, player ) camera.Destroy() }) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index ddf8cd8d..13f0f75f 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -670,14 +670,16 @@ void function CleanUpEntitiesForRoundEnd() if ( IsAlive( player ) ) player.Die( svGlobal.worldspawn, svGlobal.worldspawn, { damageSourceId = eDamageSourceId.round_end } ) - - if ( IsAlive( player.GetPetTitan() ) ) - player.GetPetTitan().Destroy() } foreach ( entity npc in GetNPCArray() ) - if ( IsValid( npc ) ) - npc.Destroy() // need this because getnpcarray includes the pettitans we just killed at this point + { + if ( !IsValid( npc ) ) + continue + + // kill rather than destroy, as destroying will cause issues with children which is an issue especially for dropships and titans + npc.Die( svGlobal.worldspawn, svGlobal.worldspawn, { damageSourceId = eDamageSourceId.round_end } ) + } // destroy weapons ClearDroppedWeapons() -- cgit v1.2.3