From 6fdbd80dd796c9334f205606fdab8c141b922de0 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sun, 17 Apr 2022 14:23:26 +0100 Subject: allow modes to not use the match timer, and clear timer on match end (#310) --- .../mod/scripts/vscripts/mp/_gamestate_mp.nut | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut index e02ca7e3..42aa4a62 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/mp/_gamestate_mp.nut @@ -9,6 +9,7 @@ global function AddCallback_OnRoundEndCleanup global function SetShouldUsePickLoadoutScreen global function SetSwitchSidesBased global function SetSuddenDeathBased +global function SetTimerBased global function SetShouldUseRoundWinningKillReplay global function SetRoundWinningKillReplayKillClasses global function SetRoundWinningKillReplayAttacker @@ -28,6 +29,7 @@ struct { bool usePickLoadoutScreen bool switchSidesBased bool suddenDeathBased + bool timerBased = true int functionref() timeoutWinnerDecisionFunc // for waitingforplayers @@ -228,7 +230,7 @@ void function GameStateEnter_Playing_Threaded() endTime = expect float( GetServerVar( "gameEndTime" ) ) // time's up! - if ( Time() >= endTime ) + if ( Time() >= endTime && file.timerBased ) { int winningTeam if ( file.timeoutWinnerDecisionFunc != null ) @@ -279,6 +281,10 @@ void function GameStateEnter_WinnerDetermined_Threaded() } WaitFrame() // wait a frame so other scripts can setup killreplay stuff + + // set gameEndTime to current time, so hud doesn't display time left in the match + SetServerVar( "gameEndTime", Time() ) + SetServerVar( "roundEndTime", Time() ) entity replayAttacker = file.roundWinningKillReplayAttacker bool doReplay = Replay_IsEnabled() && IsRoundWinningKillReplayEnabled() && IsValid( replayAttacker ) && !ClassicMP_ShouldRunEpilogue() @@ -715,6 +721,11 @@ void function SetSuddenDeathBased( bool suddenDeathBased ) file.suddenDeathBased = suddenDeathBased } +void function SetTimerBased( bool timerBased ) +{ + file.timerBased = timerBased +} + void function SetShouldUseRoundWinningKillReplay( bool shouldUse ) { SetServerVar( "roundWinningKillReplayEnabled", shouldUse ) -- cgit v1.2.3