From c02ec0cce39b36a6264e414a4741c8ea131f5286 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sun, 19 Dec 2021 23:14:00 +0000 Subject: temp fra fix --- .../mod/scripts/vscripts/_menu_callbacks.gnut | 6 ++++ .../mod/scripts/vscripts/_powerup.gnut | 32 +++++++++++++--------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut index e8deccb02..1feefc2b2 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_menu_callbacks.gnut @@ -11,6 +11,12 @@ bool function ClientCommandCallback_LeaveMatch( entity player, array arg // note: this is imperfect if we have multiple people of the same uid on a server, but that's only a thing in testing if ( NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) ) { + if ( GetConVarBool( "ns_should_return_to_lobby" ) && GetMapName() != "mp_lobby" ) + { + GameRules_EndMatch() + return true + } + foreach ( entity otherPlayer in GetPlayerArray() ) if ( otherPlayer != player ) thread WritePersistenceAndLeave( otherPlayer ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut index 5756bb533..e57533f07 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut @@ -62,32 +62,38 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) PickupGlow glow = CreatePickupGlow( powerup, powerupDef.glowColor.x.tointeger(), powerupDef.glowColor.y.tointeger(), powerupDef.glowColor.z.tointeger() ) glow.glowFX.SetOrigin( spawnpoint.GetOrigin() ) // want the glow to be parented to the powerup, but have the position of the spawnpoint - thread TrackPowerupCleanup( powerup ) + OnThreadEnd( function() : ( powerup ) + { + if ( IsValid( powerup ) ) + powerup.Destroy() + }) powerup.WaitSignal( "OnDestroy" ) wait powerupDef.respawnDelay } } -void function TrackPowerupCleanup( entity powerup ) -{ - powerup.EndSignal( "OnDestroy" ) - - svGlobal.levelEnt.WaitSignal( "CleanUpEntitiesForRoundEnd" ) - if ( IsValid( powerup ) ) - powerup.Destroy() -} - bool function OnPowerupCollected( entity player, entity healthpack ) { PowerUp powerup = GetPowerUpFromItemRef( expect string( healthpack.s.powerupRef ) ) - if ( player.IsTitan() == powerup.titanPickup ) + if ( powerup.titanPickup == player.IsTitan() ) { // hack because i couldn't figure out any other way to do this without modifying sh_powerup // ensure we don't kill the powerup if it's a battery the player can't pickup - if ( ( powerup.index == ePowerUps.titanTimeReduction || powerup.index == ePowerUps.LTS_TitanTimeReduction ) && ( player.IsTitan() || PlayerHasMaxBatteryCount( player ) ) ) - return false + if ( powerup.index == ePowerUps.titanTimeReduction || powerup.index == ePowerUps.LTS_TitanTimeReduction ) + { + if ( player.IsTitan() ) + return false + + if ( PlayerHasMaxBatteryCount( player ) ) + return false + + // this is seemingly innacurate to what fra actually did, but for whatever reason embarking with >1 bat crashes in vanilla code + // so idk this is easier + if ( GAMETYPE == FREE_AGENCY && ( IsValid( player.GetPetTitan() ) || IsTitanAvailable( player ) ) && GetPlayerBatteryCount( player ) > 0 ) + return false + } // idk why the powerup.destroyFunc doesn't just return a bool? would mean they could just handle stuff like this in powerup code powerup.destroyFunc( player ) -- cgit v1.2.3