has player.units filter by type

This commit is contained in:
Evan
2025-02-03 12:54:06 -08:00
parent bbf72bd14f
commit e750afcd65
2 changed files with 14 additions and 14 deletions
+12 -12
View File
@@ -22,12 +22,12 @@ export class DevConfig extends DefaultConfig {
// return 100
}
// unitInfo(type: UnitType): UnitInfo {
// const info = super.unitInfo(type);
// const oldCost = info.cost;
// info.cost = (p: Player) => oldCost(p) / 1000000000;
// return info;
// }
unitInfo(type: UnitType): UnitInfo {
const info = super.unitInfo(type);
const oldCost = info.cost;
info.cost = (p: Player) => oldCost(p) / 1000000000;
return info;
}
// tradeShipSpawnRate(): number {
// return 10;
@@ -45,10 +45,10 @@ export class DevConfig extends DefaultConfig {
// return 5000
// }
// numBots(): number {
// return 0
// }
// spawnNPCs(): boolean {
// return false
// }
numBots(): number {
return 0;
}
spawnNPCs(): boolean {
return false;
}
}
+2 -2
View File
@@ -109,9 +109,9 @@ export class PlayerView {
);
}
units(): UnitView[] {
units(...types: UnitType[]): UnitView[] {
return this.game
.units()
.units(...types)
.filter((u) => u.owner().smallID() == this.smallID());
}