diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/mp')
3 files changed, 56 insertions, 15 deletions
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 8e624c14a..1e19abd3a 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 @@ -86,7 +86,7 @@ void function OnPrematchStart() foreach ( entity dropshipSpawn in validDropshipSpawns ) { // todo: possibly make this only spawn dropships if we've got enough players to need them - int createTeam = HasSwitchedSides() ? dropshipSpawn.GetTeam() : GetOtherTeam( dropshipSpawn.GetTeam() ) + int createTeam = HasSwitchedSides() ? GetOtherTeam( dropshipSpawn.GetTeam() ) : dropshipSpawn.GetTeam() array<IntroDropship> teamDropships = createTeam == TEAM_MILITIA ? file.militiaDropships : file.imcDropships if ( teamDropships.len() >= 2 ) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index 63ecbf684..598b45228 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -39,7 +39,9 @@ struct { bool roundWinningKillReplayTrackPilotKills = true bool roundWinningKillReplayTrackTitanKills = false - + + bool gameWonThisFrame + bool hasKillForGameWonThisFrame float roundWinningKillReplayTime entity roundWinningKillReplayVictim entity roundWinningKillReplayAttacker @@ -282,7 +284,7 @@ void function GameStateEnter_WinnerDetermined_Threaded() entity replayAttacker = file.roundWinningKillReplayAttacker bool doReplay = Replay_IsEnabled() && IsRoundWinningKillReplayEnabled() && IsValid( replayAttacker ) - && Time() - file.roundWinningKillReplayTime <= ROUND_WINNING_KILL_REPLAY_LENGTH_OF_REPLAY + && Time() - file.roundWinningKillReplayTime <= ROUND_WINNING_KILL_REPLAY_LENGTH_OF_REPLAY && winningTeam != TEAM_UNASSIGNED float replayLength = 2.0 // extra delay if no replay if ( doReplay ) @@ -541,12 +543,22 @@ void function ForceFadeToBlack( entity player ) void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) { if ( !GamePlayingOrSuddenDeath() ) - return + { + if ( file.gameWonThisFrame ) + { + if ( file.hasKillForGameWonThisFrame ) + return + } + else + return + } // set round winning killreplay info here if we're tracking pilot kills // todo: make this not count environmental deaths like falls, unsure how to prevent this if ( file.roundWinningKillReplayTrackPilotKills && victim != attacker && attacker != svGlobal.worldspawn && IsValid( attacker ) ) { + if ( file.gameWonThisFrame ) + file.hasKillForGameWonThisFrame = true file.roundWinningKillReplayTime = Time() file.roundWinningKillReplayVictim = victim file.roundWinningKillReplayAttacker = attacker @@ -555,6 +567,12 @@ void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) file.roundWinningKillReplayHealthFrac = GetHealthFrac( attacker ) } + if ( ( Riff_EliminationMode() == eEliminationMode.Titans || Riff_EliminationMode() == eEliminationMode.PilotsTitans ) && victim.IsTitan() ) // need an extra check for this + OnTitanKilled( victim, damageInfo ) + + if ( !GamePlayingOrSuddenDeath() ) + return + // note: pilotstitans is just win if enemy team runs out of either pilots or titans if ( IsPilotEliminationBased() || GetGameState() == eGameState.SuddenDeath ) { @@ -579,21 +597,28 @@ void function OnPlayerKilled( entity victim, entity attacker, var damageInfo ) SetWinner( GetOtherTeam( victim.GetTeam() ), "#GAMEMODE_ENEMY_PILOTS_ELIMINATED", "#GAMEMODE_FRIENDLY_PILOTS_ELIMINATED" ) } } - - if ( ( Riff_EliminationMode() == eEliminationMode.Titans || Riff_EliminationMode() == eEliminationMode.PilotsTitans ) && victim.IsTitan() ) // need an extra check for this - OnTitanKilled( victim, damageInfo ) } void function OnTitanKilled( entity victim, var damageInfo ) { if ( !GamePlayingOrSuddenDeath() ) - return + { + if ( file.gameWonThisFrame ) + { + if ( file.hasKillForGameWonThisFrame ) + return + } + else + return + } // set round winning killreplay info here if we're tracking titan kills // todo: make this not count environmental deaths like falls, unsure how to prevent this entity attacker = DamageInfo_GetAttacker( damageInfo ) if ( file.roundWinningKillReplayTrackTitanKills && victim != attacker && attacker != svGlobal.worldspawn && IsValid( attacker ) ) { + if ( file.gameWonThisFrame ) + file.hasKillForGameWonThisFrame = true file.roundWinningKillReplayTime = Time() file.roundWinningKillReplayVictim = victim file.roundWinningKillReplayAttacker = attacker @@ -601,6 +626,9 @@ void function OnTitanKilled( entity victim, var damageInfo ) file.roundWinningKillReplayTimeOfDeath = Time() file.roundWinningKillReplayHealthFrac = GetHealthFrac( attacker ) } + + if ( !GamePlayingOrSuddenDeath() ) + return // note: pilotstitans is just win if enemy team runs out of either pilots or titans if ( IsTitanEliminationBased() ) @@ -706,12 +734,16 @@ void function SetRoundWinningKillReplayAttacker( entity attacker ) file.roundWinningKillReplayTime = Time() file.roundWinningKillReplayHealthFrac = GetHealthFrac( attacker ) file.roundWinningKillReplayAttacker = attacker + file.roundWinningKillReplayTimeOfDeath = Time() } void function SetWinner( int team, string winningReason = "", string losingReason = "" ) { SetServerVar( "winningTeam", team ) + file.gameWonThisFrame = true + thread UpdateGameWonThisFrameNextFrame() + if ( winningReason.len() == 0 ) file.announceRoundWinnerWinningSubstr = 0 else @@ -739,6 +771,13 @@ void function SetWinner( int team, string winningReason = "", string losingReaso } } +void function UpdateGameWonThisFrameNextFrame() +{ + WaitFrame() + file.gameWonThisFrame = false + file.hasKillForGameWonThisFrame = false +} + void function AddTeamScore( int team, int amount ) { GameRules_SetTeamScore( team, GameRules_GetTeamScore( team ) + 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 92307f3cb..11587947f 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/levels/mp_wargames.nut @@ -104,7 +104,8 @@ void function OnPrematchStart() entity militiaIon = CreatePropDynamic( $"models/titans/medium/titan_medium_ajax.mdl", < -1809.98, 2790.39, -1409 >, < 0, 80, 0 > ) thread PlayAnim( militiaIon, "at_titan_activation_wargames_intro" ) - + militiaIon.Anim_SetInitialTime( 4.5 ) + entity militiaPilot = CreateElitePilot( TEAM_UNASSIGNED, < 0, 0, 0 >, < 0, 0, 0 > ) DispatchSpawn( militiaPilot ) militiaPilot.SetParent( militiaIon, "HIJACK" ) @@ -116,7 +117,6 @@ void function OnPrematchStart() DispatchSpawn( militiaMarvinChillin ) thread PlayAnim( militiaMarvinChillin, "mv_idle_unarmed" ) - // imc grunts entity imcGrunt1 = CreatePropDynamic( $"models/humans/grunts/imc_grunt_rifle.mdl", < -2915, 2867, -1788 >, < 0, -137, 0 > ) thread PlayAnim( imcGrunt1, "pt_console_idle" ) @@ -188,6 +188,7 @@ void function PlayerWatchesWargamesIntro( entity player ) player.kv.VisibilityFlags = ENTITY_VISIBLE_TO_EVERYONE ClearPlayerAnimViewEntity( player ) player.EnableWeaponViewModel() + DeployAndEnableWeapons(player) player.ClearParent() player.UnforceStand() player.MovementEnable() @@ -224,15 +225,16 @@ void function PlayerWatchesWargamesIntro( entity player ) player.kv.VisibilityFlags = ENTITY_VISIBLE_TO_OWNER TrainingPod_ViewConeLock_PodClosed( player ) player.DisableWeaponViewModel() + HolsterAndDisableWeapons(player) 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 - if ( factionTeam == TEAM_IMC ) - Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnIMCFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() ) + if ( factionTeam == TEAM_MILITIA && GetFactionChoice( player ) == "faction_marvin" ) + Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnMilitiaFactionLeaderForIntro", file.introStartTime, playerPod.GetEncodedEHandle() ) + else if ( factionTeam == TEAM_MILITIA ) + Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnMilitiaFactionLeaderForIntro", file.introStartTime + 1.75, playerPod.GetEncodedEHandle() ) else - Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnMilitiaFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() ) + Remote_CallFunction_NonReplay( player, "ServerCallback_SpawnIMCFactionLeaderForIntro", file.introStartTime + 4.5, playerPod.GetEncodedEHandle() ) // idle pod sequence FirstPersonSequenceStruct podIdleSequence |