From 47d88983fb7a5e0cabc2a31593ce3bc427690a7a Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sat, 22 Dec 2018 03:28:16 +0100 Subject: [PATCH] Let sidebar timer count backwards if a time limit is set --- OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs index 35fc16ccff..6fb1ca0a79 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { var timer = widget.GetOrNull("GAME_TIMER"); var status = widget.GetOrNull("GAME_TIMER_STATUS"); + var tlm = world.WorldActor.TraitOrDefault(); var startTick = Ui.LastTickTime; Func shouldShowStatus = () => (world.Paused || world.Timestep != world.LobbyInfo.GlobalSettings.Timestep) @@ -51,7 +52,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (status == null && shouldShowStatus()) return statusText(); - return WidgetUtils.FormatTime(world.WorldTick, timestep); + var timeLimit = tlm != null ? tlm.TimeLimit : 0; + var displayTick = timeLimit > 0 ? timeLimit - world.WorldTick : world.WorldTick; + return WidgetUtils.FormatTime(displayTick, timestep); }; }