mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 11:18:11 +00:00
GameView: filter out inactive units.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user