diff --git a/TM_RoyalRounds_Online.Script.txt b/TM_RoyalRounds_Online.Script.txt index 7c7105b..984f226 100644 --- a/TM_RoyalRounds_Online.Script.txt +++ b/TM_RoyalRounds_Online.Script.txt @@ -37,9 +37,9 @@ #Setting S_AllowCam7DuringWaitingScreen False as "" #Setting S_RoundWaitingScreenDuration 20 as _("Round waiting screen duration") //< Maximum time spent waiting for players at the beginning of each round -/*#Setting S_WarmUpNb 0 as _("Number of warm up") // (Impossible at the moment https://forum.nadeo.com/viewtopic.php?f=51&p=8745#p8745) +#Setting S_WarmUpNb 0 as _("Number of warm up") #Setting S_WarmUpDuration 0 as _("Duration of one warm up") -#Setting S_WarmUpTimeout -1 as _("Warm up timeout")*/ +#Setting S_WarmUpTimeout -1 as _("Warm up timeout") // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Constants @@ -165,12 +165,16 @@ Server_SegmentsPerRound = S_SegmentsPerRound - 1; ***Match_InitMap*** *** +declare netwrite Text Net_ScriptEnvironment for Teams[0] = S_ScriptEnvironment; +if (Net_ScriptEnvironment != S_ScriptEnvironment) { + Net_ScriptEnvironment = S_ScriptEnvironment; +} declare Integer Map_ValidRoundsNb; declare Boolean Map_Skipped; UpdateScoresTableFooter(S_PointsLimit, S_RoundsPerMap, S_MapsPerMatch, Map_ValidRoundsNb, S_SegmentsPerRound); -declare CMapLandmark[] Map_Starts; +declare CMapLandmark[] Map_Starts for This; declare Integer Map_NextEmptyArmorCheckTime; // Find start blocks @@ -233,10 +237,48 @@ Map_Skipped = True; StartTime = Now + Race::C_SpawnDuration; -// Warm up (Impossible at the moment https://forum.nadeo.com/viewtopic.php?f=51&p=8745#p8745) -/*UIModules_ScoresTable::SetFooterInfo(_("Warm up")); +UIModules_ScoresTable::SetFooterInfo(_("Warm up")); MB_WarmUp(S_WarmUpNb, S_WarmUpDuration * 1000, S_WarmUpTimeout * 1000); -*/ +*** + +***Match_StartWarmUpRound*** +*** +declare netwrite Boolean Net_RoyalRounds_WarmUpUI_IsActive for Teams[0]; +Net_RoyalRounds_WarmUpUI_IsActive = True; +*** + +***Match_WarmUpLoop*** +*** +// Manage Custom UI Events +foreach (Event in UIManager.PendingEvents) { + Log::Log("[UIManager] Event.CustomEventType: " ^ Event.CustomEventType); + if (TL::StartsWith("Request.WarmUp.Segment.", Event.CustomEventType)) { + declare Text Target = Event.CustomEventData[0]; + declare CSmPlayer Player = GetPlayer(Target); + if (Player != Null) { + declare CMapLandmark[] Map_Starts for This; + declare netwrite Integer Net_RoyalRounds_WarmUpUI_SelectedSegment for Player = 1; + declare Integer NewSegment; + if (Event.CustomEventType == "Request.WarmUp.Segment.Minus") { + if (Net_RoyalRounds_WarmUpUI_SelectedSegment == 1) NewSegment = 5; + else NewSegment = Net_RoyalRounds_WarmUpUI_SelectedSegment - 1; + } else if (Event.CustomEventType == "Request.WarmUp.Segment.Plus") { + if (Net_RoyalRounds_WarmUpUI_SelectedSegment == 5) NewSegment = 1; + else NewSegment = Net_RoyalRounds_WarmUpUI_SelectedSegment + 1; + } + Player.LandmarkOrderSelector_Race = NewSegment; + Net_RoyalRounds_WarmUpUI_SelectedSegment = NewSegment; + Race::SetPlayerDefaultStart(Player, Map_Starts[NewSegment-1]); + Race::StopSkipOutro(Player); + } + } +} +*** + +***Match_EndWarmUpRound*** +*** +declare netwrite Boolean Net_RoyalRounds_WarmUpUI_IsActive for Teams[0]; +Net_RoyalRounds_WarmUpUI_IsActive = False; *** ***Rounds_SpawnPlayer*** @@ -286,10 +328,10 @@ CurrentRanking[0] = Integer[Text]; // Init white section declare Boolean IsStartRound = True; // Reset players for the race -foreach (Player in Players) { - declare Integer CurrentSegment for Player.Score = -1; +foreach (Score in Scores) { // TODO Change segment for spectators alwell (Test if change works) + declare Integer CurrentSegment for Score = -1; CurrentSegment = 1; - CurrentRanking[0][Player.User.WebServicesUserId] = 0; + CurrentRanking[0][Score.User.WebServicesUserId] = 0; } declare Integer UpdateRankingTimer = 1; @@ -424,6 +466,10 @@ if ( UpdateScoresTableFooter(S_PointsLimit, S_RoundsPerMap, S_MapsPerMatch, Map_ValidRoundsNb, S_SegmentsPerRound); } +if (Net_ScriptEnvironment != S_ScriptEnvironment) { + Net_ScriptEnvironment = S_ScriptEnvironment; +} + if (Net_RoyalRounds_CheckpointUI_TotalNbSegments != S_SegmentsPerRound) { Net_RoyalRounds_CheckpointUI_TotalNbSegments = S_SegmentsPerRound; } @@ -726,8 +772,6 @@ Boolean MapIsOver(Boolean _UseTieBreak, Integer _PointsLimit, Integer _ValidRoun * Set the UI */ Void SetML() { - declare TotalWidth = 44.5; - declare Text MLText = """ + + + +"""; + Layers::Create("ML_RoyalRounds_WarmUpUI", MLText); + Layers::SetType("ML_RoyalRounds_WarmUpUI", CUILayer::EUILayerType::Normal); + Layers::Attach("ML_RoyalRounds_WarmUpUI"); }