Skip to content

Instantly share code, notes, and snippets.

@Aessi
Last active May 31, 2016 08:57
Show Gist options
  • Save Aessi/9805f2ee61671954174e34d3185cb776 to your computer and use it in GitHub Desktop.
Save Aessi/9805f2ee61671954174e34d3185cb776 to your computer and use it in GitHub Desktop.
Fix give up issue
// ---------------------------------- //
/** Unspawn a racing player and send him in the outro sequence
*
* @param _Player The player to unspawn
* @param _DisplayScoresTable Display the scores table during the outro
*/
Void EndRace(CTmPlayer _Player, Boolean _DisplayScoresTable) {
if (_Player == Null) return;
declare LibTM2_SpawnStatus for _Player = C_SpawnStatus_Waiting;
// @Test start
// Don't switch to the outro status if the player was not racing
// Force the waiting status in this case
// This happens because the give up event can arrive at the
// same time or a few milliseconds before the finish event
// on the server side
declare IsRacing = (
LibTM2_SpawnStatus == C_SpawnStatus_Racing &&
_Player.IsSpawned == True &&
_Player.RaceStartTime >= 0 &&
_Player.RaceStartTime <= Now
);
if (!IsRacing) {
WaitRace(_Player);
return;
}
// @Test end
LibTM2_SpawnStatus = C_SpawnStatus_Outro;
Private_OutroStart(_Player, _DisplayScoresTable);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment