fix unit not function error

This commit is contained in:
evanpelle
2025-01-23 16:16:09 -08:00
committed by Evan
parent ae02056948
commit 375326ed64
2 changed files with 6 additions and 1 deletions
+4
View File
@@ -70,6 +70,10 @@ export class PlayerView {
return this.game.worker.playerInteraction(this.id(), this.game.x(tile), this.game.y(tile))
}
units(): UnitView[] {
return this.game.units().filter(u => u.owner().smallID() == this.smallID())
}
nameLocation(): NameViewData {
return this.nameData
}
+2 -1
View File
@@ -1,5 +1,6 @@
import { Difficulty, GameType, Gold, Player, PlayerInfo, PlayerType, TerrainType, TerraNullius, Tick, UnitInfo, UnitType } from "../game/Game";
import { GameMap, TileRef } from "../game/GameMap";
import { PlayerView } from "../GameView";
import { GameConfig } from "../Schemas";
import { assertNever, within } from "../Util";
import { Config, ServerConfig, Theme } from "./Config";
@@ -276,7 +277,7 @@ export class DefaultConfig implements Config {
return 25000
}
maxPopulation(player: Player): number {
maxPopulation(player: Player | PlayerView): number {
let maxPop = Math.pow(player.numTilesOwned(), .6) * 1000 + 50000
if (player.type() == PlayerType.Bot) {
return maxPop