From 7ce7086c33c29e20797b2ad000204f12ecee5a4b Mon Sep 17 00:00:00 2001 From: Xuarig Date: Thu, 20 Mar 2025 13:40:52 -0400 Subject: [PATCH] [UI/Bugfix] Fixed the player info overlay displaying false when troops where equal to 0 (#298) The player info was: ![Before](https://github.com/user-attachments/assets/1fc3a4f1-3052-4a0d-b310-f94de10178a0) I fixed it to: ![After](https://github.com/user-attachments/assets/901ffc10-4d93-4418-9d56-e3b94a4fb5af) One thing I'm not sure about, is if we want to hide the attacking troops on 0 or always show it? In this PR it's always shown. --- .../graphics/layers/PlayerInfoOverlay.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/client/graphics/layers/PlayerInfoOverlay.ts b/src/client/graphics/layers/PlayerInfoOverlay.ts index 0d071bd1a..19ce5d599 100644 --- a/src/client/graphics/layers/PlayerInfoOverlay.ts +++ b/src/client/graphics/layers/PlayerInfoOverlay.ts @@ -205,14 +205,16 @@ export class PlayerInfoOverlay extends LitElement implements Layer { ${player.name()}
Type: ${playerType}
- ${player.troops() >= 1 && - html`
- Defending troops: ${renderTroops(player.troops())} -
`} - ${attackingTroops >= 1 && - html`
- Attacking troops: ${renderTroops(attackingTroops)} -
`} + ${player.troops() >= 1 + ? html`
+ Defending troops: ${renderTroops(player.troops())} +
` + : ""} + ${attackingTroops >= 1 + ? html`
+ Attacking troops: ${renderTroops(attackingTroops)} +
` + : ""}
Gold: ${renderNumber(player.gold())}