diff options
Diffstat (limited to 'Northstar.CustomServers/scripts/vscripts/gamemodes')
4 files changed, 77 insertions, 129 deletions
diff --git a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut index 82c304b6..b9d5aa49 100644 --- a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut +++ b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_lts.nut @@ -18,57 +18,26 @@ void function GamemodeLts_Init() SetRoundBased( true ) SetRespawnsEnabled( false ) Riff_ForceSetEliminationMode( eEliminationMode.PilotsTitans ) + Riff_ForceSetSpawnAsTitan( eSpawnAsTitan.Always ) SetShouldUseRoundWinningKillReplay( true ) SetRoundWinningKillReplayKillClasses( true, true ) // both titan and pilot kills are tracked - - AddDamageCallback( "player", OnPlayerDamaged ) - AddDamageCallback( "npc_titan", OnTitanDamaged ) - + AddCallback_OnPilotBecomesTitan( RefreshThirtySecondWallhackHighlight ) AddCallback_OnTitanBecomesPilot( RefreshThirtySecondWallhackHighlight ) SetTimeoutWinnerDecisionFunc( CheckTitanHealthForDraw ) + TrackTitanDamageInPlayerGameStat( PGS_ASSAULT_SCORE ) - ClassicMP_SetCustomIntro( GamemodeLTS_Intro, 0.0 ) // dont any sorta timer + ClassicMP_SetCustomIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() ) + AddCallback_GameStateEnter( eGameState.Playing, WaitForThirtySecondsLeft ) } -// this should also probably be moved into a generic intro rather than being lts-specific -void function GamemodeLTS_Intro() +void function WaitForThirtySecondsLeft() { - AddCallback_GameStateEnter( eGameState.Prematch, LTSIntroOnPrematchStart ) + thread WaitForThirtySecondsLeftThreaded() } -void function LTSIntroOnPrematchStart() -{ - ClassicMP_OnIntroStarted() - - foreach ( entity player in GetPlayerArray() ) - thread LTSIntroSpawnPlayer( player ) - - wait 2.0 // literally a guess number for how long the drop might take - - ClassicMP_OnIntroFinished() - - thread GamemodeLTS_PlayingThink() -} - -void function LTSIntroSpawnPlayer( entity player ) -{ - if ( IsAlive( player ) ) - { - player.Die() - WaitFrame() // this doesn't work for some reason but the player will die in roundend anyway so not really an issue - } - - thread RespawnAsTitan( player, false ) - - while ( !player.IsTitan() ) - WaitFrame() - - TryGameModeAnnouncement( player ) -} - -void function GamemodeLTS_PlayingThink() +void function WaitForThirtySecondsLeftThreaded() { svGlobal.levelEnt.EndSignal( "RoundEnd" ) // end this on round end @@ -121,7 +90,7 @@ int function CheckTitanHealthForDraw() } } - // note: due to how stuff is set up rn, there's actually no way to do win/loss reasons in timeout decision funcs + // note: due to how stuff is set up rn, there's actually no way to do win/loss reasons outside of a SetWinner call, i.e. not in timeout winner decision // as soon as there is, strings in question are "#GAMEMODE_TITAN_TITAN_ADVANTAGE" and "#GAMEMODE_TITAN_TITAN_DISADVANTAGE" if ( militiaTitans != imcTitans ) @@ -130,26 +99,4 @@ int function CheckTitanHealthForDraw() return militiaHealth > imcHealth ? TEAM_MILITIA : TEAM_IMC return TEAM_UNASSIGNED -} - -// this should be generic, not restricted to a specific gamemode -void function AddToTitanDamageStat( entity victim, var damageInfo ) -{ - // todo: this needs to not count selfdamage - entity attacker = DamageInfo_GetAttacker( damageInfo ) - float amount = DamageInfo_GetDamage( damageInfo ) - - if ( attacker.IsPlayer() && attacker != victim ) - attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, amount ) // titan damage on -} - -void function OnPlayerDamaged( entity player, var damageInfo ) -{ - if ( player.IsTitan() ) - AddToTitanDamageStat( player, damageInfo ) -} - -void function OnTitanDamaged( entity titan, var damageInfo ) -{ - AddToTitanDamageStat( titan, damageInfo ) }
\ No newline at end of file diff --git a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_speedball.nut b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_speedball.nut index 91ebf8c6..4532fb97 100644 --- a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_speedball.nut +++ b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_speedball.nut @@ -25,7 +25,7 @@ void function GamemodeSpeedball_Init() AddCallback_OnPlayerKilled( OnPlayerKilled ) SetTimeoutWinnerDecisionFunc( TimeoutCheckFlagHolder ) - ClassicMP_SetCustomIntro( ClassicMP_DefaultNoIntro_Setup, NOINTRO_INTRO_LENGTH ) + ClassicMP_SetCustomIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() ) } void function CreateFlag( entity flagSpawn ) diff --git a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ttdm.nut b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ttdm.nut index 92119c1c..faf3e5ca 100644 --- a/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ttdm.nut +++ b/Northstar.CustomServers/scripts/vscripts/gamemodes/_gamemode_ttdm.nut @@ -1,6 +1,73 @@ global function GamemodeTTDM_Init +const float TTDMIntroLength = 15.0 + void function GamemodeTTDM_Init() { + Riff_ForceSetSpawnAsTitan( eSpawnAsTitan.Always ) + Riff_ForceTitanExitEnabled( eTitanExitEnabled.Never ) + TrackTitanDamageInPlayerGameStat( PGS_ASSAULT_SCORE ) + + ClassicMP_SetCustomIntro( TTDMIntroSetup, TTDMIntroLength ) + + AddCallback_OnPlayerKilled( AddTeamScoreForPlayerKilled ) // dont have to track autotitan kills since you cant leave your titan in this mode + + // probably needs scoreevent earnmeter values +} + +void function TTDMIntroSetup() +{ + // this should show intermission cam for 15 sec in prematch, before spawning players as titans + AddCallback_GameStateEnter( eGameState.Prematch, TTDMIntroStart ) + AddCallback_OnClientConnected( TTDMIntroShowIntermissionCam ) +} + +void function TTDMIntroStart() +{ + thread TTDMIntroStartThreaded() +} + +void function TTDMIntroStartThreaded() +{ + ClassicMP_OnIntroStarted() + + foreach ( entity player in GetPlayerArray() ) + TTDMIntroShowIntermissionCam( player ) + + wait TTDMIntroLength + + ClassicMP_OnIntroFinished() +} +void function TTDMIntroShowIntermissionCam( entity player ) +{ + if ( GetGameState() != eGameState.Prematch ) + return + + thread PlayerWatchesTTDMIntroIntermissionCam( player ) +} + +void function PlayerWatchesTTDMIntroIntermissionCam( entity player ) +{ + ScreenFadeFromBlack( player ) + + entity intermissionCam = GetEntArrayByClass_Expensive( "info_intermission" )[ 0 ] + + // the angle set here seems sorta inconsistent as to whether it actually works or just stays at 0 for some reason + player.SetObserverModeStaticPosition( intermissionCam.GetOrigin() ) + player.SetObserverModeStaticAngles( intermissionCam.GetAngles() ) + player.StartObserverMode( OBS_MODE_STATIC_LOCKED ) + + wait TTDMIntroLength + + RespawnAsTitan( player, false ) + TryGameModeAnnouncement( player ) +} + +void function AddTeamScoreForPlayerKilled( entity victim, entity attacker, var damageInfo ) +{ + if ( victim == attacker || !victim.IsPlayer() || !attacker.IsPlayer() ) + return + + AddTeamScore( GetOtherTeam( victim.GetTeam() ), 1 ) }
\ No newline at end of file diff --git a/Northstar.CustomServers/scripts/vscripts/gamemodes/sh_gamemode_mfd.nut b/Northstar.CustomServers/scripts/vscripts/gamemodes/sh_gamemode_mfd.nut deleted file mode 100644 index 4410a513..00000000 --- a/Northstar.CustomServers/scripts/vscripts/gamemodes/sh_gamemode_mfd.nut +++ /dev/null @@ -1,66 +0,0 @@ -untyped - -global function GamemodeMfdShared_Init -global function GetMarked -global function GetPendingMarked -global function FillMFDMarkers -global function TargetsMarkedImmediately -global function IsTitanMarkedForDeathMode - -void function GamemodeMfdShared_Init() -{ - // mfd mfdActiveMarkedPlayerEnt are server side entities with a boss player that marks the marked - level.mfdActiveMarkedPlayerEnt <- {} - level.mfdActiveMarkedPlayerEnt[ TEAM_IMC ] <- null - level.mfdActiveMarkedPlayerEnt[ TEAM_MILITIA ] <- null - - level.mfdPendingMarkedPlayerEnt <- {} - level.mfdPendingMarkedPlayerEnt[ TEAM_IMC ] <- null - level.mfdPendingMarkedPlayerEnt[ TEAM_MILITIA ] <- null - - SetWaveSpawnInterval( 8.0 ) -} - -entity function GetMarked( int team ) -{ - if ( IsValid( level.mfdActiveMarkedPlayerEnt[ team ] ) ) - return expect entity( level.mfdActiveMarkedPlayerEnt[ team ] ).GetOwner() - - return null -} - -entity function GetPendingMarked( int team ) -{ - if ( IsValid( level.mfdPendingMarkedPlayerEnt[ team ] ) ) - return expect entity( level.mfdPendingMarkedPlayerEnt[ team ] ).GetOwner() - - return null -} - -function FillMFDMarkers( entity ent ) //Ent used for kill replay related issues... -{ - print( "FillMFDMarkers " + ent ) - - if ( ent.GetTargetName() == MARKET_ENT_MARKED_NAME ) - { - Assert( ent.GetTeam() != TEAM_UNASSIGNED ) - level.mfdActiveMarkedPlayerEnt[ ent.GetTeam() ] = ent - } - else if ( ent.GetTargetName() == MARKET_ENT_PENDING_MARKED_NAME ) - { - Assert( ent.GetTeam() != TEAM_UNASSIGNED ) - level.mfdPendingMarkedPlayerEnt[ ent.GetTeam() ] = ent - } - - return -} - -function TargetsMarkedImmediately() -{ - return IsRoundBased() && IsPilotEliminationBased() -} - -bool function IsTitanMarkedForDeathMode() -{ - return GetCurrentPlaylistVarInt( "titan_marked_for_death", 0 ) == 1 -}
\ No newline at end of file |