From 79bbd4def785bac4d5f0a580f643cf1adf9047f8 Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 9 Feb 2025 09:44:37 -0800 Subject: [PATCH] GameView: filter out inactive units. --- src/core/game/GameView.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/game/GameView.ts b/src/core/game/GameView.ts index bde421c9e..ff1416c7f 100644 --- a/src/core/game/GameView.ts +++ b/src/core/game/GameView.ts @@ -333,10 +333,10 @@ export class GameView implements GameMap { } units(...types: UnitType[]): UnitView[] { if (types.length == 0) { - return Array.from(this._units.values()); + return Array.from(this._units.values()).filter((u) => u.isActive()); } - return Array.from(this._units.values()).filter((u) => - types.includes(u.type()) + return Array.from(this._units.values()).filter( + (u) => u.isActive() && types.includes(u.type()) ); } unit(id: number): UnitView {