Compare commits

..

2 Commits

Author SHA1 Message Date
Beu
04b4137078 add Big Message when someone have a perfect time 2024-04-10 11:07:21 +02:00
Beu
1e9c428fb0 Fix chat spamming bug 2024-04-10 10:42:23 +02:00

View File

@ -204,7 +204,7 @@ foreach (Event in RacePendingEvents) {
Scores::UpdatePlayerBestRaceIfBetter(Event.Player);
Scores::UpdatePlayerBestLapIfBetter(Event.Player);
Scores::UpdatePlayerPrevRace(Event.Player);
ComputeLatestRaceScores();
ComputeLatestRaceScores(False);
Race::SortScores(Race::C_Sort_TotalPoints);
// Start the countdown if it's the first player to finish
@ -263,16 +263,18 @@ if (Round_ForceEndRound || Round_SkipPauseRound || Round_Skipped) {
} else {
Map_ValidRoundsNb += 1;
// Get the last round points
ComputeLatestRaceScores();
ComputeLatestRaceScores(True);
Race::SortScores(Race::C_Sort_TotalPoints);
UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::ForcedVisible;
UIManager.UIAll.UISequence = CUIConfig::EUISequence::EndRound;
MB_Sleep(3000);
MB_Sleep(S_ChatTime * 1000 / 3);
UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::ForcedVisible;
MB_Sleep(S_ChatTime * 1000 / 3);
// Add them to the total scores
ComputeScores();
UIModules_ScoresTable::SetCustomPoints([]);
Race::SortScores(Race::C_Sort_TotalPoints);
MB_Sleep(3000);
MB_Sleep(S_ChatTime * 1000 / 3);
UIModules_BigMessage::SetMessage("");
UIManager.UIAll.ScoreTableVisibility = CUIConfig::EVisibility::Normal;
UIManager.UIAll.UISequence = CUIConfig::EUISequence::Playing;
@ -392,7 +394,7 @@ Text FormatPlayerName(Text _Name) {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
/// Compute the latest race scores
Void ComputeLatestRaceScores() {
Void ComputeLatestRaceScores(Boolean _DisplayMessages) {
Race::SortScores(Race::C_Sort_PrevRaceTime);
// Points distributed between all players
@ -423,7 +425,7 @@ Void ComputeLatestRaceScores() {
foreach (Delta => CustomScores in ScoresPerAbsoluteDelta) {
// Attribute less points if they have the same time
if (CustomScores.count > 1) {
if (_DisplayMessages && CustomScores.count > 1) {
I += CustomScores.count - 1;
declare Text Names;
foreach (Key => Score in CustomScores) {
@ -448,7 +450,11 @@ Void ComputeLatestRaceScores() {
if (Delta == 0 && CustomScores.count == 1) {
Points += S_BonusForPerfect;
UIManager.UIAll.SendChat("$ff3" ^ FormatPlayerName(Score.User.Name) ^ " did the perfect time");
if (_DisplayMessages) {
UIManager.UIAll.SendChat("$ff3" ^ FormatPlayerName(Score.User.Name) ^ " did the perfect time");
UIModules_BigMessage::SetMessage(FormatPlayerName(Score.User.Name) ^ " did the perfect time");
ModeUtils::PlaySound(CUIConfig::EUISound::TieBreakPoint, 0);
}
}
Scores::SetPlayerRoundPoints(Score, Points);
}