aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomeoCantCode <romeoloeffel@gmail.com>2022-03-29 23:01:11 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-03-30 00:04:30 +0200
commit163a77686a40856ccbffdbb7d09f1cf398e24005 (patch)
treef89c670a5d089c6d06bf22f62452354be9a97eb4
parent464825cb304b070fb0d497f47a3e8a8d831d5248 (diff)
downloadNorthstarMods-163a77686a40856ccbffdbb7d09f1cf398e24005.tar.gz
NorthstarMods-163a77686a40856ccbffdbb7d09f1cf398e24005.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()." )
}