From 7cac56cb9bcaabed9562a7b46718f5c5de3400b8 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Fri, 17 Dec 2021 21:53:06 +0000 Subject: wargames intro and many fixes --- .../vscripts/gamemodes/_gamemode_coliseum.nut | 93 +++++++++++++++++++++- .../scripts/vscripts/gamemodes/_gamemode_cp.nut | 40 +++++++++- .../scripts/vscripts/gamemodes/_gamemode_ctf.nut | 2 +- .../scripts/vscripts/gamemodes/_gamemode_ffa.nut | 3 +- .../scripts/vscripts/gamemodes/_gamemode_lts.nut | 1 + .../vscripts/gamemodes/_gamemode_speedball.nut | 1 + 6 files changed, 133 insertions(+), 7 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts/vscripts/gamemodes') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut index e0664b1ef..88a95fe41 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_coliseum.nut @@ -36,11 +36,14 @@ void function GamemodeColiseum_Init() ClassicMP_SetCustomIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() ) AddCallback_GameStateEnter( eGameState.Prematch, ShowColiseumIntroScreen ) AddCallback_OnPlayerRespawned( GivePlayerColiseumLoadout ) + + ClassicMP_SetEpilogue( SetupColiseumEpilogue ) } // stub function referenced in sh_gamemodes_mp void function GamemodeColiseum_CustomIntro( entity player ) -{} +{ +} void function ShowColiseumIntroScreen() { @@ -56,7 +59,6 @@ void function ShowColiseumIntroScreenThreaded() foreach ( entity player in GetPlayerArray() ) { - array otherTeam = GetPlayerArrayOfTeam( GetOtherTeam( player.GetTeam() ) ) int winstreak = 0 @@ -106,6 +108,7 @@ void function GivePlayerColiseumLoadout( entity player ) coliseumLoadout.primary = GetColiseumItem( "primary" ) coliseumLoadout.primaryMods = [ GetColiseumItem( "primary_attachment" ), GetColiseumItem( "primary_mod1" ), GetColiseumItem( "primary_mod2" ), GetColiseumItem( "primary_mod3" ) ] + coliseumLoadout.primaryAttachments = [] // will likely crash if we dont do this coliseumLoadout.secondary = GetColiseumItem( "secondary" ) coliseumLoadout.secondaryMods = [ GetColiseumItem( "secondary_mod1" ), GetColiseumItem( "secondary_mod2" ), GetColiseumItem( "secondary_mod3" ) ] @@ -129,4 +132,88 @@ string function GetColiseumItem( string name ) return expect string ( GetCurrentPlaylistVar( "coliseum_" + name ) ) } -// todo this needs the outro: unsure what anims it uses \ No newline at end of file +void function SetupColiseumEpilogue() +{ + AddCallback_GameStateEnter( eGameState.Epilogue, RunColiseumOutro ) +} + +void function RunColiseumOutro() +{ + entity outroAnimPoint = GetEnt( "intermission" ) + array winningPlayers = GetPlayerArrayOfTeam( GetWinningTeam() ) + + if ( GetPlayerArray().len() > 0 && IsValid( outroAnimPoint ) && GetWinningTeam() != -1 && winningPlayers.len() != 0 ) // this will fail if we don't have players or a spot to do it + thread RunColiseumOutroThreaded( outroAnimPoint.GetOrigin(), winningPlayers[ 0 ] ) + else + SetGameState( eGameState.Postmatch ) +} + +void function RunColiseumOutroThreaded( vector point, entity winningPlayer ) +{ + OnThreadEnd( function() : () + { + SetGameState( eGameState.Postmatch ) + }) + + winningPlayer.EndSignal( "OnDestroy" ) + + // pick winner and loser anims + int numLost = GameRules_GetTeamScore( GetOtherTeam( GetWinningTeam() ) ) + int animIndex = RandomInt( OUTROANIMS_WINNER[ numLost ].len() ) + string winnerAnim = OUTROANIMS_WINNER[ numLost ][ animIndex ] + string loserAnim = OUTROANIMS_LOSER[ numLost ][ animIndex ] + + foreach ( entity player in GetPlayerArray() ) + { + if ( !IsAlive( player ) ) + player.RespawnPlayer( null ) + + AddCinematicFlag( player, CE_FLAG_HIDE_MAIN_HUD ) + ScreenFadeFromBlack( player, 0.5 ) + player.SetOrigin( point ) + player.SetNameVisibleToEnemy( false ) + player.SetNameVisibleToFriendly( false ) + // for some reason this just doesn't use the mp music system, so have to manually play this + // odd game + EmitSoundOnEntityOnlyToPlayer( player, player, "music_mp_speedball_game_win" ) + + FirstPersonSequenceStruct outroSequence + outroSequence.thirdPersonCameraAttachments = [ "VDU" ] + outroSequence.blendTime = 0.25 + outroSequence.attachment = "ref" + outroSequence.enablePlanting = true + outroSequence.playerPushable = false + + // for when we kill any active weapons if not needed for anim + entity playerWeapon = player.GetActiveWeapon() + + if ( player.GetTeam() == GetWinningTeam() ) + { + if ( IsValid( playerWeapon ) ) + playerWeapon.Destroy() + + outroSequence.thirdPersonAnim = winnerAnim + outroSequence.noParent = true + outroSequence.gravity = true + thread FirstPersonSequence( outroSequence, player ) + } + else + { + // need weapon for this anim in particular + if ( IsValid( playerWeapon ) && loserAnim != "pt_coliseum_loser_gunkick" ) + playerWeapon.Destroy() + + outroSequence.thirdPersonAnim = loserAnim + outroSequence.useAnimatedRefAttachment = true + thread FirstPersonSequence( outroSequence, player, winningPlayer ) + } + } + + // all outro anims should be the same length ideally + wait winningPlayer.GetSequenceDuration( winnerAnim ) - 0.75 + + foreach ( entity player in GetPlayerArray() ) + ScreenFadeToBlackForever( player, 0.75 ) + + wait 0.75 +} \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index 41f5fedbf..4ea25fa7a 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -34,10 +34,46 @@ void function GamemodeCP_Init() void function RateSpawnpoints_CP( int checkClass, array spawnpoints, int team, entity player ) { - // check hardpoints + if ( HasSwitchedSides() ) + team = GetOtherTeam( team ) + // check hardpoints, determine which ones we own array startSpawns = SpawnPoints_GetPilotStart( team ) - array enemyStartSpawns = SpawnPoints_GetPilotStart( GetOtherTeam( team ) ) + vector averageFriendlySpawns + + // average out startspawn positions + foreach ( entity spawnpoint in startSpawns ) + averageFriendlySpawns += spawnpoint.GetOrigin() + + averageFriendlySpawns /= startSpawns.len() + + entity friendlyHardpoint // determine our furthest out hardpoint + foreach ( entity hardpoint in HARDPOINTS ) + { + if ( hardpoint.GetTeam() == player.GetTeam() && GetGlobalNetFloat( "objective" + hardpoint.kv.hardpointGroup + "Progress" ) >= 0.95 ) + { + if ( IsValid( friendlyHardpoint ) ) + { + if ( Distance2D( averageFriendlySpawns, hardpoint.GetOrigin() ) > Distance2D( averageFriendlySpawns, friendlyHardpoint.GetOrigin() ) ) + friendlyHardpoint = hardpoint + } + else + friendlyHardpoint = hardpoint + } + } + + vector ratingPos + if ( IsValid( friendlyHardpoint ) ) + ratingPos = friendlyHardpoint.GetOrigin() + else + ratingPos = averageFriendlySpawns + + foreach ( entity spawnpoint in spawnpoints ) + { + // idk about magic number here really + float rating = 1.0 - ( Distance2D( spawnpoint.GetOrigin(), ratingPos ) / 1000.0 ) + spawnpoint.CalculateRating( checkClass, player.GetTeam(), rating, rating ) + } } void function SpawnHardpoints() diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut index 3213827d1..7f879c69c 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ctf.nut @@ -134,7 +134,7 @@ bool function VerifyCTFSpawnpoint( entity spawnpoint, int team ) { // ensure spawnpoints aren't too close to enemy base - if ( HasSwitchedSides() && spawnpoint.GetTeam() >= TEAM_IMC ) + if ( HasSwitchedSides() ) team = GetOtherTeam( team ) array startSpawns = SpawnPoints_GetPilotStart( team ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut index 85b4aefbd..6a8b3ea47 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_ffa.nut @@ -12,6 +12,7 @@ void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) if ( victim != attacker && victim.IsPlayer() && attacker.IsPlayer() && GetGameState() == eGameState.Playing ) { AddTeamScore( attacker.GetTeam(), 1 ) - attacker.AddToPlayerGameStat( PGS_SCORE, 1 ) + // why isn't this PGS_SCORE? odd game + attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, 1 ) } } \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut index 194db8a04..5de78b536 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_lts.nut @@ -30,6 +30,7 @@ void function GamemodeLts_Init() TrackTitanDamageInPlayerGameStat( PGS_ASSAULT_SCORE ) ClassicMP_SetCustomIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() ) + ClassicMP_ForceDisableEpilogue( true ) AddCallback_GameStateEnter( eGameState.Playing, WaitForThirtySecondsLeft ) } diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut index 4532fb972..abc9013a5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut @@ -26,6 +26,7 @@ void function GamemodeSpeedball_Init() SetTimeoutWinnerDecisionFunc( TimeoutCheckFlagHolder ) ClassicMP_SetCustomIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() ) + ClassicMP_ForceDisableEpilogue( true ) } void function CreateFlag( entity flagSpawn ) -- cgit v1.2.3