diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts')
8 files changed, 56 insertions, 20 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut index ac5b8129..a4f23b85 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut @@ -192,8 +192,10 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa dropship.SetValueForModelKey( $"models/vehicle/crow_dropship/crow_dropship_hero.mdl" ) DispatchSpawn( dropship ) dropship.SetModel( $"models/vehicle/crow_dropship/crow_dropship_hero.mdl" ) + AddEntityCallback_OnKilled( dropship, EvacDropshipKilled ) dropship.s.evacSlots <- [ null, null, null, null, null, null, null, null ] + file.evacDropship = dropship dropship.EndSignal( "OnDestroy" ) OnThreadEnd( function() : ( evacTeam, completionCallback, dropship ) @@ -372,4 +374,16 @@ bool function PlayerInDropship( entity player, entity dropship ) return true return false +} + +void function EvacDropshipKilled( entity dropship, var damageInfo ) +{ + foreach ( entity player in dropship.s.evacSlots ) + { + if ( IsValid( player ) ) + { + player.ClearParent() + player.Die( DamageInfo_GetAttacker( damageInfo ), DamageInfo_GetWeapon( damageInfo ), { damageSourceId = eDamageSourceId.evac_dropship_explosion, scriptType = DF_GIB } ) + } + } }
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut index a7dc00de..9e5d95ba 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ttdm.nut @@ -11,6 +11,7 @@ void function GamemodeTTDM_Init() SetLoadoutGracePeriodEnabled( false ) ClassicMP_SetCustomIntro( TTDMIntroSetup, TTDMIntroLength ) + ClassicMP_ForceDisableEpilogue( true ) AddCallback_OnPlayerKilled( AddTeamScoreForPlayerKilled ) // dont have to track autotitan kills since you cant leave your titan in this mode diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut index b5c6ea32..08cc9d0b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut @@ -39,10 +39,6 @@ bool function ClientCommandCallback_PrivateMatchLaunch( entity player, array<str { if ( file.startState == ePrivateMatchStartState.STARTING ) { - if ( GetConVarBool( "ns_private_match_only_host_can_start" ) ) - if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) ) - return true - // cancel start if we're already mid-countdown file.startState = ePrivateMatchStartState.READY SetUIVar( level, "privatematch_starting", ePrivateMatchStartState.READY ) @@ -50,6 +46,10 @@ bool function ClientCommandCallback_PrivateMatchLaunch( entity player, array<str } else { + if ( GetConVarBool( "ns_private_match_only_host_can_start" ) ) + if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) ) + return true + // start match file.startState = ePrivateMatchStartState.STARTING thread StartMatch() @@ -123,8 +123,8 @@ void function StartMatch() SetUIVar( level, "privatematch_starting", ePrivateMatchStartState.STARTING ) // start countdown - SetUIVar( level, "gameStartTime", Time() + 15 ) - float countdownEndTime = Time() + 15.0 + SetUIVar( level, "gameStartTime", Time() + GetConVarFloat( "ns_private_match_countdown_length" ) ) + float countdownEndTime = Time() + GetConVarFloat( "ns_private_match_countdown_length" ) // can't use start here because we need to check stuff while ( Time() < countdownEndTime ) @@ -159,7 +159,7 @@ void function StartMatch() SetConVarString( "ns_private_match_last_map", file.map ) SetConVarString( "ns_private_match_last_mode", file.mode ) - SetConVarBool( "ns_should_return_to_lobby", true ) // potentially temp? + //SetConVarBool( "ns_should_return_to_lobby", true ) // potentially temp? string mode = file.mode if ( !( mode in GAMETYPE_TEXT ) ) @@ -206,7 +206,7 @@ bool function ClientCommandCallback_PrivateMatchSetPlaylistVarOverride( entity p if ( GetConVarInt( "ns_private_match_only_host_can_change_settings" ) >= 1 ) if ( !NSIsPlayerIndexLocalPlayer( player.GetPlayerIndex() ) ) return true - + bool found = false foreach ( string category in GetPrivateMatchSettingCategories() ) { 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 6945fb96..62f7d459 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_base_gametype_mp.gnut @@ -42,6 +42,7 @@ void function BaseGametype_Init_MPSP() AddPostDamageCallback( "npc_titan", AddToTitanDamageStat ) RegisterSignal( "PlayerRespawnStarted" ) + RegisterSignal( "KillCamOver" ) } void function SetIntermissionCamera( entity camera ) @@ -316,8 +317,10 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga player.SetObserverTarget( null ) } + // hack: double check if killcams are enabled and valid here in case gamestate has changed this + shouldDoReplay = shouldDoReplay && Replay_IsEnabled() && KillcamsEnabled() && IsValid( attacker ) // quick note: in cases where player.Die() is called: e.g. for round ends, player == attacker - if ( shouldDoReplay && Replay_IsEnabled() && KillcamsEnabled() && IsValid( attacker ) ) // hack: double check if killcams are enabled and valid here in case gamestate has changed this + if ( shouldDoReplay ) { player.watchingKillreplayEndTime = Time() + replayLength float beforeTime = GetKillReplayBeforeTime( player, methodOfDeath ) @@ -355,7 +358,12 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga RespawnAsPilot( player ) } else if ( GamePlayingOrSuddenDeath() || GetGameState() == eGameState.Epilogue ) + { + if ( shouldDoReplay && player.IsWatchingKillReplay() ) + player.WaitSignal( "KillCamOver" ) + thread PlayerBecomesSpectator( player ) + } } void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, float timeSinceAttackerSpawned, float timeOfDeath, float beforeTime, table replayTracker ) @@ -373,6 +381,7 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl // don't clear if we're in a roundwinningkillreplay if ( IsValid( player ) && !( ( GetGameState() == eGameState.SwitchingSides || GetGameState() == eGameState.WinnerDetermined ) && IsRoundWinningKillReplayEnabled() ) ) { + player.Signal( "KillCamOver" ) player.ClearReplayDelay() player.ClearViewEntity() player.SetPredictionEnabled( true ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut index 470fa6a4..16a3ce92 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_changemap.nut @@ -34,7 +34,10 @@ void function CodeCallback_MatchIsOver() for ( int j = 0; j < GetCurrentPlaylistGamemodeByIndexMapsCount( i ); j++ ) { if ( changeOnNextIteration ) + { GameRules_ChangeMap( GetCurrentPlaylistGamemodeByIndexMapByIndex( i, j ), GetCurrentPlaylistGamemodeByIndex( i ) ) + return + } if ( GetCurrentPlaylistGamemodeByIndexMapByIndex( i, j ) == GetMapName() ) changeOnNextIteration = true // change to next map/mode we iterate over diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut index fdcc468c..4f6a1291 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_classic_mp_dropship_intro.gnut @@ -146,7 +146,7 @@ void function SpawnPlayerIntoDropship( entity player ) int playerDropshipIndex = -1 foreach ( IntroDropship dropship in teamDropships ) for ( int i = 0; i < dropship.players.len(); i++ ) - if ( dropship.players[ i ] == player ) + if ( dropship.players[ i ] == null ) { playerDropship = dropship playerDropshipIndex = i @@ -203,6 +203,9 @@ void function SpawnPlayerIntoDropship( entity player ) void function PlayerJumpsFromDropship( entity player ) { + player.EndSignal( "OnDeath" ) + player.EndSignal( "OnDestroy" ) + OnThreadEnd( function() : ( player ) { if ( IsValid( player ) ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 562f65e5..2f16379e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -451,6 +451,7 @@ void function GameStateEnter_SwitchingSides_Threaded() void function PlayerWatchesSwitchingSidesKillReplay( entity player, bool doReplay, float replayLength ) { + player.EndSignal( "OnDestroy" ) player.FreezeControlsOnServer() ScreenFadeToBlackForever( player, SWITCHING_SIDES_DELAY_REPLAY ) // automatically cleared @@ -717,18 +718,21 @@ void function SetWinner( int team, string winningReason = "", string losingReaso else file.announceRoundWinnerLosingSubstr = GetStringID( losingReason ) - if ( IsRoundBased() ) - { - if ( team != TEAM_UNASSIGNED ) - { - GameRules_SetTeamScore( team, GameRules_GetTeamScore( team ) + 1 ) - GameRules_SetTeamScore2( team, GameRules_GetTeamScore2( team ) + 1 ) + if ( GamePlayingOrSuddenDeath() ) + { + if ( IsRoundBased() ) + { + if ( team != TEAM_UNASSIGNED ) + { + GameRules_SetTeamScore( team, GameRules_GetTeamScore( team ) + 1 ) + GameRules_SetTeamScore2( team, GameRules_GetTeamScore2( team ) + 1 ) + } + + SetGameState( eGameState.WinnerDetermined ) } - - SetGameState( eGameState.WinnerDetermined ) + else + SetGameState( eGameState.WinnerDetermined ) } - else - SetGameState( eGameState.WinnerDetermined ) } void function AddTeamScore( int team, int amount ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut index 58a4be02..92307f3c 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut @@ -191,6 +191,7 @@ void function PlayerWatchesWargamesIntro( entity player ) player.ClearParent() player.UnforceStand() player.MovementEnable() + player.ClearInvulnerable() Remote_CallFunction_NonReplay( player, "ServerCallback_ClearFactionLeaderIntro" ) } }) @@ -224,6 +225,7 @@ void function PlayerWatchesWargamesIntro( entity player ) TrainingPod_ViewConeLock_PodClosed( player ) player.DisableWeaponViewModel() player.MovementDisable() + player.SetInvulnerable() // spawn faction leader // no clue why client subtracts 4.5 from the time we give this, so just add it here instead |