diff options
author | DBmaoha <56738369+DBmaoha@users.noreply.github.com> | 2022-10-22 02:48:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 19:48:43 +0100 |
commit | 89814b24cbdc7cd9a9ba07acae08570b4d188dfe (patch) | |
tree | 9008f09aeb09a2f7beced84e36f8f93e76258bf9 | |
parent | 3c03047f9a0e3d06004cc5fe008e457396fccbf7 (diff) | |
download | NorthstarMods-89814b24cbdc7cd9a9ba07acae08570b4d188dfe.tar.gz NorthstarMods-89814b24cbdc7cd9a9ba07acae08570b4d188dfe.zip |
Hide and seek crash fix (#488)
* Fixed Hide and Seek droppod respawn crash
Added EndSignal() and IsValid() check
* Added IsValid()
-rw-r--r-- | Northstar.Custom/mod/scripts/vscripts/_droppod_spawn.gnut | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Northstar.Custom/mod/scripts/vscripts/_droppod_spawn.gnut b/Northstar.Custom/mod/scripts/vscripts/_droppod_spawn.gnut index 7447fc59..5bc75db2 100644 --- a/Northstar.Custom/mod/scripts/vscripts/_droppod_spawn.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/_droppod_spawn.gnut @@ -14,7 +14,10 @@ void function DropPodSpawn_Init() void function CleanupSpawningDropPods() { foreach ( entity pod in file.droppods ) - pod.Destroy() + { + if( IsValid( pod ) ) + pod.Destroy() + } file.droppods.clear() } @@ -22,6 +25,7 @@ void function CleanupSpawningDropPods() void function SpawnPlayersInDropPod( array< entity > players, vector targetOrigin, vector angles, float destructionTime = -1 ) { entity pod = CreateDropPod( targetOrigin, angles ) + pod.EndSignal( "OnDestroy" ) file.droppods.append( pod ) svGlobal.levelEnt.EndSignal( "CleanUpEntitiesForRoundEnd" ) @@ -35,9 +39,11 @@ void function SpawnPlayersInDropPod( array< entity > players, vector targetOrigi foreach ( entity player in players ) { + if( !IsValid( player ) ) + continue if ( !IsAlive( player ) ) player.RespawnPlayer( null ) - + player.SetOrigin( pod.GetOrigin() ) player.SetAngles( pod.GetAngles() ) player.SetParent( pod ) @@ -49,8 +55,12 @@ void function SpawnPlayersInDropPod( array< entity > players, vector targetOrigi // wait for this LaunchAnimDropPod( pod, "pod_testpath", targetOrigin, angles ) + if( !GamePlaying() ) + return foreach ( entity player in players ) { + if( !IsValid( player ) ) + continue player.ClearParent() player.ClearViewEntity() player.UnfreezeControlsOnServer() @@ -61,8 +71,12 @@ void function SpawnPlayersInDropPod( array< entity > players, vector targetOrigi WaitFrame() vector doorPos = pod.GetAttachmentOrigin( pod.LookupAttachment( "hatch" ) ) + if( !GamePlaying() ) + return foreach ( entity player in players ) { + if( !IsValid( player ) ) + continue vector viewAngles = doorPos - player.GetOrigin() viewAngles.x = 3.0 |