Compare commits

..

6 Commits

Author SHA1 Message Date
beu
dcd89d584d use SmallScoresTable to display delta 2025-05-08 09:36:08 +02:00
beu
da04fba158 fix round count with pause or skipped round 2025-02-16 01:20:17 +01:00
beu
a0496073da fix missing constant 2025-02-14 16:51:16 +01:00
beu
ab7dd77649 fix first eliminated score to be reseted 2025-02-09 10:49:51 +01:00
beu
b57aaa5179 fix useless update when cam 7 2025-01-30 16:56:31 +01:00
beu
26cc4f63d9 bump version 2025-01-18 14:03:59 +01:00
2 changed files with 27 additions and 8 deletions

View File

@ -4,7 +4,7 @@
#Extends "Modes/Nadeo/Trackmania/Base/TrackmaniaRoundsBase.Script.txt" #Extends "Modes/Nadeo/Trackmania/Base/TrackmaniaRoundsBase.Script.txt"
#Const CompatibleMapTypes "TrackMania\\TM_Race,TM_Race" #Const CompatibleMapTypes "TrackMania\\TM_Race,TM_Race"
#Const Version "2025-01-18" #Const Version "2025-02-15"
#Const ScriptName "Modes/TM2020-Gamemodes/TM_MultiLivesKnockout.Script.txt" #Const ScriptName "Modes/TM2020-Gamemodes/TM_MultiLivesKnockout.Script.txt"
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
@ -76,6 +76,7 @@
#Const C_HudModulePath "" //< Path to the hud module #Const C_HudModulePath "" //< Path to the hud module
#Const C_ManiaAppUrl "file://Media/ManiaApps/Nadeo/Trackmania/Modes/Knockout.Script.txt" //< Url of the mania app #Const C_ManiaAppUrl "file://Media/ManiaApps/Nadeo/Trackmania/Modes/Knockout.Script.txt" //< Url of the mania app
#Const C_FakeUsersNb 0
#Const C_ElimMode_Rounds 2 #Const C_ElimMode_Rounds 2
#Const C_ElimMode_Lives 1 #Const C_ElimMode_Lives 1
@ -509,7 +510,8 @@ if (Round_ForceEndRound || Round_SkipPauseRound || Round_Skipped) {
LostLifeAccountIds.add(Score.User.WebServicesUserId); LostLifeAccountIds.add(Score.User.WebServicesUserId);
if (!ScoreIsAlive(Score)) { if (!ScoreIsAlive(Score)) {
Scores::SetPlayerMatchPoints(Score, ParticipantsNb - Rank); // Registered Score must have at least 1 point or a best race time to not be reset at end of the map: https://forum.nadeo.com/viewtopic.php?t=4365
Scores::SetPlayerMatchPoints(Score, ParticipantsNb + 1 - Rank);
EliminatedAccountIds.add(Score.User.WebServicesUserId); EliminatedAccountIds.add(Score.User.WebServicesUserId);
EliminatedRanks.add(Rank); EliminatedRanks.add(Rank);
@ -956,7 +958,7 @@ Boolean MatchIsOver(Integer _RoundNb) {
*/ */
Boolean MapIsOver(Integer _RoundNb) { Boolean MapIsOver(Integer _RoundNb) {
if (MatchIsOver(_RoundNb)) return True; if (MatchIsOver(_RoundNb)) return True;
if (S_RoundsPerMap > 0 && MB_GetRoundCount() >= S_RoundsPerMap) return True; //< There is a rounds limit and it is reached if (S_RoundsPerMap > 0 && MB_GetValidRoundCount() >= S_RoundsPerMap) return True; //< There is a rounds limit and it is reached
return False; return False;
} }
@ -1005,8 +1007,8 @@ Void UpdateMatchInfos(Integer _CurrentRoundNb, Integer _LossOfLife, Integer _Ali
if (MapNumber == 0) MapNumber = 3; if (MapNumber == 0) MapNumber = 3;
if (_CurrentRoundNb == -1) MatchInfo = "Warm Up"; if (_CurrentRoundNb == -1) MatchInfo = "Warm Up";
else if (S_EliminationMode == C_ElimMode_Rounds) MatchInfo = "Match Round "^ _CurrentRoundNb ^ " - Round "^ ML::Max(MB_GetRoundCount(), 1) ^"/"^ S_RoundsPerMap ^" of Map "^ MapNumber ^"/"^ MapList.count; else if (S_EliminationMode == C_ElimMode_Rounds) MatchInfo = "Match Round "^ _CurrentRoundNb ^ " - Round "^ ML::Max(MB_GetValidRoundCount(), 1) ^"/"^ S_RoundsPerMap ^" of Map "^ MapNumber ^"/"^ MapList.count;
else MatchInfo = "Round "^ ML::Max(MB_GetRoundCount(), 1) ^"/"^ S_RoundsPerMap ^ " - Map "^ MapNumber ^"/"^ MapList.count; else MatchInfo = "Round "^ ML::Max(MB_GetValidRoundCount(), 1) ^"/"^ S_RoundsPerMap ^ " - Map "^ MapNumber ^"/"^ MapList.count;
} else if (_CurrentRoundNb == -1) { } else if (_CurrentRoundNb == -1) {
MatchInfo = "Warm Up"; MatchInfo = "Warm Up";
} else { } else {
@ -1635,7 +1637,7 @@ main() {
} }
if (GUIPlayer == Null && Last_GUIPlayer != NullId) { if (GUIPlayer == Null && Last_GUIPlayer != NullId) {
Last_GUIPlayer == NullId; Last_GUIPlayer = NullId;
UpdateLiveRanking = True; UpdateLiveRanking = True;
} else if (GUIPlayer != Null && Last_GUIPlayer != GUIPlayer.Id) { } else if (GUIPlayer != Null && Last_GUIPlayer != GUIPlayer.Id) {
Last_GUIPlayer = GUIPlayer.Id; Last_GUIPlayer = GUIPlayer.Id;

View File

@ -5,7 +5,7 @@
#Extends "Modes/Nadeo/Trackmania/Base/TrackmaniaRoundsBase.Script.txt" #Extends "Modes/Nadeo/Trackmania/Base/TrackmaniaRoundsBase.Script.txt"
#Const CompatibleMapTypes "TrackMania\\TM_Race,TM_Race" #Const CompatibleMapTypes "TrackMania\\TM_Race,TM_Race"
#Const Version "2024-11-29" #Const Version "2025-05-08"
#Const ScriptName "Modes/TM2020-Gamemodes/TM_RoundsNearest.Script.txt" #Const ScriptName "Modes/TM2020-Gamemodes/TM_RoundsNearest.Script.txt"
// #RequireContext CSmMode // #RequireContext CSmMode
@ -21,6 +21,7 @@
#Include "Libs/Nadeo/TMGame/Utils/Tracking.Script.txt" as Tracking #Include "Libs/Nadeo/TMGame/Utils/Tracking.Script.txt" as Tracking
#Include "Libs/Nadeo/TMGame/Modes/Base/UIModules/Checkpoint_Server.Script.txt" as UIModules_Checkpoint #Include "Libs/Nadeo/TMGame/Modes/Base/UIModules/Checkpoint_Server.Script.txt" as UIModules_Checkpoint
#Include "Libs/Nadeo/TMGame/Modes/Base/UIModules/PauseMenuOnline_Server.Script.txt" as UIModules_PauseMenu_Online #Include "Libs/Nadeo/TMGame/Modes/Base/UIModules/PauseMenuOnline_Server.Script.txt" as UIModules_PauseMenu_Online
#Include "Libs/Nadeo/Trackmania/Modes/Rounds/UIModules/SmallScoresTable_Server.Script.txt" as UIModules_SmallScoresTable
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
// Settings // Settings
@ -68,6 +69,7 @@ Log::RegisterScript(ScriptName, Version);
Log::RegisterScript(Semver::ScriptName, Semver::Version); Log::RegisterScript(Semver::ScriptName, Semver::Version);
Log::RegisterScript(ModeUtils::ScriptName, ModeUtils::Version); Log::RegisterScript(ModeUtils::ScriptName, ModeUtils::Version);
Log::RegisterScript(StateMgr::ScriptName, StateMgr::Version); Log::RegisterScript(StateMgr::ScriptName, StateMgr::Version);
Log::RegisterScript(UIModules_SmallScoresTable::ScriptName, UIModules_SmallScoresTable::Version);
*** ***
***Match_LoadLibraries*** ***Match_LoadLibraries***
@ -112,7 +114,7 @@ UIManager.UIAll.OverlayHideSpectatorInfos = True;
UIManager.UIAll.OverlayHideCountdown = True; UIManager.UIAll.OverlayHideCountdown = True;
UIModules_ScoresTable::DisplayRoundPoints(True); UIModules_ScoresTable::DisplayRoundPoints(True);
UIModules::UnloadModules(["UIModule_Race_TimeGap", "UIModule_Rounds_SmallScoresTable"]); UIModules::UnloadModules(["UIModule_Race_TimeGap"]);
*** ***
***Match_Yield*** ***Match_Yield***
@ -164,6 +166,8 @@ Server_MapsPerMatch = S_MapsPerMatch - 1;
***Match_StartMatch*** ***Match_StartMatch***
*** ***
UIModules_ScoresTable::SetCustomPoints([]); UIModules_ScoresTable::SetCustomPoints([]);
UIModules_SmallScoresTable::ResetCustomTimes();
UIModules_SmallScoresTable::ResetCustomResults();
*** ***
***Match_InitMap*** ***Match_InitMap***
@ -314,6 +318,8 @@ if (Round_ForceEndRound || Round_SkipPauseRound || Round_Skipped) {
MB_StopMap(); MB_StopMap();
} }
} }
UIModules_SmallScoresTable::ResetCustomTimes();
UIModules_SmallScoresTable::ResetCustomResults();
*** ***
***Match_EndMap*** ***Match_EndMap***
@ -463,6 +469,8 @@ Void ComputeLatestRaceScores(Boolean _IsEndRound) {
declare Text[][Text] CustomPoints = GetWinnersCustomPoints(); declare Text[][Text] CustomPoints = GetWinnersCustomPoints();
declare CSmScore[][Integer] ScoresPerAbsoluteDelta; declare CSmScore[][Integer] ScoresPerAbsoluteDelta;
declare Integer[Text] CustomTimes;
declare Text[Text] CustomResult;
foreach (Score in Scores) { foreach (Score in Scores) {
if (Score.User == Null) continue; if (Score.User == Null) continue;
if (Scores::GetPlayerPrevRaceTime(Score) <= 0) continue; if (Scores::GetPlayerPrevRaceTime(Score) <= 0) continue;
@ -478,6 +486,12 @@ Void ComputeLatestRaceScores(Boolean _IsEndRound) {
TextDelta ^= DeltaTimeToText(AbsoluteDelta); TextDelta ^= DeltaTimeToText(AbsoluteDelta);
if (S_PointsLimit < 0 || Scores::GetPlayerMatchPoints(Score) < S_PointsLimit) { if (S_PointsLimit < 0 || Scores::GetPlayerMatchPoints(Score) < S_PointsLimit) {
CustomPoints[Score.User.WebServicesUserId] = [Scores::GetPlayerMatchPoints(Score) ^ " (" ^ TextDelta ^ ")"]; CustomPoints[Score.User.WebServicesUserId] = [Scores::GetPlayerMatchPoints(Score) ^ " (" ^ TextDelta ^ ")"];
if (AbsoluteDelta == 0) {
CustomResult[Score.User.WebServicesUserId] = "PERFECT";
} else {
CustomResult[Score.User.WebServicesUserId] = TextDelta;
}
CustomTimes[Score.User.WebServicesUserId] = AbsoluteDelta;
} }
} }
UIModules_ScoresTable::SetCustomPoints(CustomPoints); UIModules_ScoresTable::SetCustomPoints(CustomPoints);
@ -552,6 +566,9 @@ Void ComputeLatestRaceScores(Boolean _IsEndRound) {
I += 1; I += 1;
} }
UIModules_SmallScoresTable::SetCustomTimes(CustomTimes);
UIModules_SmallScoresTable::SetCustomResults(CustomResult);
} }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //