mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-08 17:42:51 +00:00
game kind of working with GameView
This commit is contained in:
@@ -159,6 +159,7 @@ export interface TerrainMap {
|
||||
neighbors(terrainTile: TerrainTile): TerrainTile[]
|
||||
width(): number
|
||||
height(): number
|
||||
isOnMap(cell: Cell): boolean
|
||||
}
|
||||
|
||||
export interface TerrainTile extends SearchNode {
|
||||
|
||||
@@ -47,7 +47,7 @@ export class GameImpl implements MutableGame {
|
||||
public eventBus: EventBus,
|
||||
private _config: Config,
|
||||
) {
|
||||
this._terraNullius = new TerraNulliusImpl(this)
|
||||
this._terraNullius = new TerraNulliusImpl()
|
||||
this._width = _terrainMap.width();
|
||||
this._height = _terrainMap.height();
|
||||
this._numLandTiles = _terrainMap.numLandTiles
|
||||
@@ -145,7 +145,7 @@ export class GameImpl implements MutableGame {
|
||||
}
|
||||
|
||||
inSpawnPhase(): boolean {
|
||||
return this._ticks <= this.config().numSpawnPhaseTurns(this.config().gameConfig().gameType)
|
||||
return this._ticks <= this.config().numSpawnPhaseTurns()
|
||||
}
|
||||
|
||||
ticks(): number {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {ClientID} from "../Schemas";
|
||||
import {TerraNullius, Cell, Tile, PlayerID} from "./Game";
|
||||
import {GameImpl} from "./GameImpl";
|
||||
import { ClientID } from "../Schemas";
|
||||
import { TerraNullius, Cell, Tile, PlayerID } from "./Game";
|
||||
import { GameImpl } from "./GameImpl";
|
||||
|
||||
|
||||
export class TerraNulliusImpl implements TerraNullius {
|
||||
public tiles: Map<Cell, Tile> = new Map<Cell, Tile>();
|
||||
|
||||
|
||||
constructor(private gs: GameImpl) {
|
||||
constructor() {
|
||||
}
|
||||
clientID(): ClientID {
|
||||
return "TERRA_NULLIUS_CLIENT_ID"
|
||||
@@ -20,5 +20,5 @@ export class TerraNulliusImpl implements TerraNullius {
|
||||
ownsTile(cell: Cell): boolean {
|
||||
return this.tiles.has(cell);
|
||||
}
|
||||
isPlayer(): false {return false as const;}
|
||||
isPlayer(): false { return false as const; }
|
||||
}
|
||||
|
||||
@@ -85,6 +85,9 @@ export class TerrainMapImpl implements TerrainMap {
|
||||
public nationMap: NationMap
|
||||
constructor(
|
||||
) { }
|
||||
isOnMap(cell: Cell): boolean {
|
||||
return cell.x >= 0 && cell.x < this.tiles.length && cell.y >= 0 && cell.y < this.tiles[0].length
|
||||
}
|
||||
|
||||
neighbors(terrainTile: TerrainTile): TerrainTile[] {
|
||||
return (terrainTile as TerrainTileImpl).neighbors();
|
||||
|
||||
Reference in New Issue
Block a user