aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers
diff options
context:
space:
mode:
authorx3Karma <juliuslimck@gmail.com>2023-03-03 05:33:04 +0800
committerGitHub <noreply@github.com>2023-03-02 22:33:04 +0100
commitbd99d5a6b1d8de68215df6b503474f93073a02f7 (patch)
tree944b3180d2cfbfde6e4e3d14978c9f0dfb29335e /Northstar.CustomServers
parent85e2c14c5979cf350b488cd42abf9084d4a64bb1 (diff)
downloadNorthstarMods-bd99d5a6b1d8de68215df6b503474f93073a02f7.tar.gz
NorthstarMods-bd99d5a6b1d8de68215df6b503474f93073a02f7.zip
Fix GameTime_TimeLeftSeconds() not tracking time correctly (#447)v1.12.6-rc1v1.12.6v1.12.5-rc1
Co-authored-by: EladNLG <44613424+EladNLG@users.noreply.github.com>
Diffstat (limited to 'Northstar.CustomServers')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut23
1 files changed, 8 insertions, 15 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
index 3546e3b7a..4e5c5aa9b 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut
@@ -4017,7 +4017,7 @@ int function GameTime_TimeLeftMinutes()
if ( GetGameState() == eGameState.Prematch )
return int( ( expect float( GetServerVar( "gameStartTime" ) ) - Time()) / 60.0 )
- return floor( GameTime_TimeLimitMinutes() - GameTime_PlayingTime() / 60 ).tointeger()
+ return floor( GameTime_PlayingTime() / 60 ).tointeger()
}
int function GameTime_TimeLeftSeconds()
@@ -4025,30 +4025,25 @@ int function GameTime_TimeLeftSeconds()
if ( GetGameState() == eGameState.Prematch )
return int( expect float( GetServerVar( "gameStartTime" ) ) - Time() )
- return floor( GameTime_TimeLimitSeconds() - GameTime_PlayingTime() ).tointeger()
+ return GameTime_PlayingTime().tointeger()
}
+// WARN: this function includes WaitingForPlayers and Prematch duration!
int function GameTime_Seconds()
{
return floor( Time() ).tointeger()
}
+// WARN: this function includes WaitingForPlayers Prematch duration!
int function GameTime_Minutes()
{
return int( floor( GameTime_Seconds() / 60 ) )
}
+// this function only counts the time limit during eGameState.Playing
float function GameTime_PlayingTime()
{
- return GameTime_PlayingTimeSince( Time() )
-}
-
-float function GameTime_PlayingTimeSince( float sinceTime )
-{
int gameState = GetGameState()
-
- // temp fix because i have no fucking clue why this crashes
-
if ( gameState < eGameState.Playing )
return 0
@@ -4057,17 +4052,15 @@ float function GameTime_PlayingTimeSince( float sinceTime )
if ( gameState > eGameState.SuddenDeath )
return (expect float( GetServerVar( "roundEndTime" ) ) - expect float( GetServerVar( "roundStartTime" ) ) )
else
- return sinceTime - expect float( GetServerVar( "roundStartTime" ) )
-
+ return floor( expect float( GetServerVar( "roundEndTime" ) ) - Time() )
}
else
{
if ( gameState > eGameState.SuddenDeath )
return (expect float( GetServerVar( "gameEndTime" ) ) - expect float( GetServerVar( "gameStartTime" ) ) )
else
- return sinceTime - expect float( GetServerVar( "gameStartTime" ) )
+ return floor( expect float( GetServerVar( "gameEndTime" ) ) - Time() )
}
-
unreachable
}
@@ -4411,4 +4404,4 @@ bool function PlayerHasTitan( entity player )
return true
return false
-} \ No newline at end of file
+}