Skip to content

Fix GameTime_PlayingTime()#1004

Open
ASillyNeko wants to merge 15 commits into
R2Northstar:mainfrom
ASillyNeko:fix-gametime-playingtime
Open

Fix GameTime_PlayingTime()#1004
ASillyNeko wants to merge 15 commits into
R2Northstar:mainfrom
ASillyNeko:fix-gametime-playingtime

Conversation

@ASillyNeko

Copy link
Copy Markdown
Contributor

Fixes GameTime_PlayingTime() being reversed

Fixes

bool function ShouldStartSpawn( entity player )
{
if ( Riff_FloorIsLava() )
return false
if ( Flag( "ForceStartSpawn" ) )
return true
if ( Flag( "IgnoreStartSpawn" ) )
return false
if ( GetGameState() <= eGameState.Prematch )
return true
if ( player.s.respawnCount )
return false
return GameTime_PlayingTime() < START_SPAWN_GRACE_PERIOD
}
and
function TryETATitanReadyAnnouncement( entity player )
{
// printt( "TryETATitanReadyAnnouncement" )
if ( !IsAlive( player ) )
return
if ( GetPlayerTitanInMap( player ) )
return
if ( player.GetNextTitanRespawnAvailable() < 0 )
return
if ( GetGameState() > eGameState.SuddenDeath )
return
if ( GameTime_PlayingTime() < 5.0 )
return
local timeTillNextTitan = player.GetNextTitanRespawnAvailable() - Time()
// printt( "TryETATitanReadyAnnouncement timetillNextTitan: " + timeTillNextTitan )
if ( floor( timeTillNextTitan ) <= 0 )
{
// Titan is ready, let TryReplacementTitanReadyAnnouncement take care of it
TryReplacementTitanReadyAnnouncement( player )
return
}
// This entire loop is probably too complicated now for what it's doing. Simplify next game!
// Loop might be pretty hard to read, a particular iteration of the loop is written in comments below
for ( int i = 0; i < file.ETATimeThresholds.len(); ++i )
{
if ( fabs( timeTillNextTitan - file.ETATimeThresholds[ i ] ) < file.ETAAnnouncementAllowanceTime )
{
if ( player.p.replacementTitanETATimer > file.ETATimeThresholds[ i ] )
{
if ( player.titansBuilt )
PlayConversationToPlayer( "TitanReplacementETA" + file.ETATimeThresholds[ i ] + "s", player )
else
PlayConversationToPlayer( "FirstTitanETA" + file.ETATimeThresholds[ i ] + "s", player )
player.p.replacementTitanETATimer = float( file.ETATimeThresholds[ i ] )
wait timeTillNextTitan - file.ETATimeThresholds[ i ]
if ( IsAlive( player ) )
SetTitanRespawnTimer( player, player.GetNextTitanRespawnAvailable() - Time() )
return
}
}
}
/*if ( fabs( timeTillNextTitan - 120 ) < ETAAnnouncementAllowanceTime && player.p.replacementTitanETATimer > 120 )
{
if ( player.titansBuilt )
PlayConversationToPlayer( "TitanReplacementETA120s", player )
else
PlayConversationToPlayer( "FirstTitanETA120s", player )
player.p.replacementTitanETATimer = 120
wait timeTillNextTitan - 120
SetTitanRespawnTimer( player, player.GetNextTitanRespawnAvailable() - Time() )
return
}
*/
}

Correct (pr)
image

Incorrect (current)
image

@github-actions github-actions Bot added needs testing Changes from the PR still need to be tested needs code review Changes from PR still need to be reviewed in code labels Jun 20, 2026
@catornot

Copy link
Copy Markdown
Member

I wonder if this would break any mods

@ASillyNeko ASillyNeko marked this pull request as draft June 20, 2026 20:10
@ASpoonPlaysGames

Copy link
Copy Markdown
Contributor

I wonder if this would break any mods

Probably not. If it does then I'd be surprised since it counting down doesn't really make much sense given the name.

@ASillyNeko ASillyNeko marked this pull request as ready for review June 20, 2026 22:38
SetServerVar( "switchedSides", 0 )
SetServerVar( "winningTeam", -1 )

AddCallback_GameStateEnter( eGameState.WaitingForCustomStart, GameStateEnter_WaitingForCustomStart )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it was fine as is

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it doesn't script error, also how respawn does it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review Changes from PR still need to be reviewed in code needs testing Changes from the PR still need to be tested

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants