diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts')
4 files changed, 30 insertions, 9 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut index 60c4560f..5fb0778c 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_powerup.gnut @@ -33,21 +33,17 @@ void function PowerupSpawnerThink( entity spawnpoint, PowerUp powerupDef ) svGlobal.levelEnt.EndSignal( "CleanUpEntitiesForRoundEnd" ) entity base = CreatePropDynamic( powerupDef.baseModel, spawnpoint.GetOrigin(), spawnpoint.GetAngles(), 2 ) - - entity powerup - OnThreadEnd( function() : ( base, powerup ) + OnThreadEnd( function() : ( base ) { base.Destroy() - if ( IsValid( powerup ) ) - powerup.Destroy() }) - + while ( true ) { if ( !powerupDef.spawnFunc() ) return - powerup = CreateEntity( "item_powerup" ) + entity powerup = CreateEntity( "item_powerup" ) powerup.SetOrigin( base.GetOrigin() + powerupDef.modelOffset ) powerup.SetAngles( base.GetAngles() + powerupDef.modelAngles ) @@ -66,11 +62,22 @@ 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 ) + 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 ) ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut index 89f9c991..194db8a0 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut @@ -46,6 +46,8 @@ void function WaitForThirtySecondsLeftThreaded() // wait until 30sec left wait ( endTime - 30 ) - Time() + PlayMusicToAll( eMusicPieceID.LEVEL_LAST_MINUTE ) + foreach ( entity player in GetPlayerArray() ) { // warn there's 30 seconds left 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 5a0ec989..0425f1d7 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -40,6 +40,8 @@ void function BaseGametype_Init_MPSP() AddDamageCallback( "player", AddToTitanDamageStat ) AddDamageCallback( "npc_titan", AddToTitanDamageStat ) + + RegisterSignal( "PlayerRespawnStarted" ) } void function SetIntermissionCamera( entity camera ) @@ -394,6 +396,8 @@ void function RespawnAsPilot( entity player, bool manualPosition = false ) void function RespawnAsTitan( entity player, bool manualPosition = false ) { + player.Signal( "PlayerRespawnStarted" ) + player.isSpawning = true entity spawnpoint = FindSpawnPoint( player, true, ShouldStartSpawn( player ) && !IsFFAGame() ) @@ -459,9 +463,16 @@ void function PlayerBecomesSpectator( entity player ) player.EndSignal( "OnRespawned" ) player.EndSignal( "OnDestroy" ) + player.EndSignal( "PlayerRespawnStarted" ) int targetIndex = 0 + OnThreadEnd( function() : ( player ) + { + if ( IsValid( player ) ) + player.StopObserverMode() + }) + while ( true ) { table result = player.WaitSignal( "ObserverTargetChanged" ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 58c8bb9b..83d889dd 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -320,10 +320,11 @@ void function GameStateEnter_WinnerDetermined_Threaded() foreach( entity player in GetPlayerArray() ) { player.FreezeControlsOnServer() - ScreenFadeToBlackForever( player, 2.0 ) + ScreenFadeToBlackForever( player, 4.0 ) } - wait 2.5 + wait 6.5 + CleanUpEntitiesForRoundEnd() // fade should be done by this point, so cleanup stuff now when people won't see foreach( entity player in GetPlayerArray() ) player.UnfreezeControlsOnServer() |