From 7921261ac901171e42889f263be6dd3acba20b79 Mon Sep 17 00:00:00 2001 From: tnhnblgl <51187395+tnhnblgl@users.noreply.github.com> Date: Mon, 8 Jun 2026 22:58:18 +0300 Subject: [PATCH] Countdown before game start (#4198) Resolves #4178 ## Description: Let's the timer countdown remaining time to start in spawn phase Screenshot_2026-06-06-11-24-26-193_com
android chrome ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory ## Please put your Discord username so you can be contacted if a bug or regression is found: Dovg --- src/client/hud/layers/GameRightSidebar.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client/hud/layers/GameRightSidebar.ts b/src/client/hud/layers/GameRightSidebar.ts index 47750465d..88472d718 100644 --- a/src/client/hud/layers/GameRightSidebar.ts +++ b/src/client/hud/layers/GameRightSidebar.ts @@ -111,13 +111,12 @@ export class GameRightSidebar extends LitElement implements Controller { this.requestUpdate(); } - const maxTimerValue = this.game.config().gameConfig().maxTimerValue; - if (this.game.inSpawnPhase()) { - this.timer = - maxTimerValue !== null && maxTimerValue !== undefined - ? maxTimerValue * 60 - : 0; + const spawnPhaseDurationTicks = this.game.config().numSpawnPhaseTurns(); + const currentTicks = this.game.ticks(); + const remainingTicks = spawnPhaseDurationTicks - currentTicks; + const remainingSeconds = Math.ceil(remainingTicks / 10); + this.timer = Math.max(0, remainingSeconds); return; } @@ -127,6 +126,7 @@ export class GameRightSidebar extends LitElement implements Controller { return; } + const maxTimerValue = this.game.config().gameConfig().maxTimerValue; if (maxTimerValue !== null && maxTimerValue !== undefined) { this.timer = Math.max(0, maxTimerValue * 60 - elapsedSeconds); } else {