From 74d300bd010d68817ddad1c16aaafea98e0615c4 Mon Sep 17 00:00:00 2001 From: RomeoCantCode Date: Tue, 29 Mar 2022 23:01:11 +0200 Subject: Fix servercrash because batteryContainer entity is null (#267) ...when respawning as titan --- .../mod/scripts/vscripts/mp/_base_gametype_mp.gnut | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Northstar.CustomServers/mod/scripts') 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()." ) } -- cgit v1.2.3