aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomeoCantCode <romeoloeffel@gmail.com>2022-03-29 23:01:11 +0200
committerGitHub <noreply@github.com>2022-03-29 23:01:11 +0200
commit74d300bd010d68817ddad1c16aaafea98e0615c4 (patch)
treeb750efb59ec5be7229f1eeba8797190b71e77ff9
parent6dfe2856e8c4b9c533f0c380abbfd4b6fada3518 (diff)
downloadNorthstarMods-74d300bd010d68817ddad1c16aaafea98e0615c4.tar.gz
NorthstarMods-74d300bd010d68817ddad1c16aaafea98e0615c4.zip
Fix servercrash because batteryContainer entity is null (#267)
...when respawning as titan
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut7
1 files changed, 6 insertions, 1 deletions
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 8d29c612..5d5742c3 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut
@@ -484,7 +484,12 @@ void function RespawnAsTitan( entity player, bool manualPosition = false )
player.RespawnPlayer( null ) // spawn player as pilot so they get their pilot loadout on embark
player.SetOrigin( titan.GetOrigin() )
- PilotBecomesTitan( player, titan ) // make player titan
+ // don't make player titan when entity batteryContainer is not valid.
+ // This will prevent a servercrash that sometimes occur when evac is disabled and somebody is calling a titan in the defeat screen.
+ if( IsValid( titan.GetTitanSoul().soul.batteryContainer ) )
+ PilotBecomesTitan( player, titan ) // make player titan
+ else
+ print( "batteryContainer is not a valid entity in RespawnAsTitan(). Skipping PilotBecomesTitan()." )
}