AStar returns cell instead of path

This commit is contained in:
evanpelle
2024-12-03 14:35:09 -08:00
parent 330b6b93cb
commit 4edd66dc1f
12 changed files with 57 additions and 59 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
import { Cell, Execution, MutableGame, MutablePlayer, MutableUnit, PlayerID, Tile, UnitType } from "../game/Game";
import { Cell, Execution, MutableGame, MutablePlayer, MutableUnit, PlayerID, TerrainType, Tile, UnitType } from "../game/Game";
import { PathFinder } from "../pathfinding/PathFinding";
import { PathFindResultType } from "../pathfinding/AStar";
import { SerialAStar } from "../pathfinding/SerialAStar";
@@ -14,7 +14,7 @@ export class DestroyerExecution implements Execution {
private mg: MutableGame = null
private target: MutableUnit = null
private pathfinder = PathFinder.Serial(5000, t => t.isWater())
private pathfinder: PathFinder
private patrolTile: Tile;
private patrolCenterTile: Tile
@@ -29,6 +29,7 @@ export class DestroyerExecution implements Execution {
init(mg: MutableGame, ticks: number): void {
this.pathfinder = PathFinder.Serial(mg, 5000, t => t.terrainType() == TerrainType.Ocean)
this._owner = mg.player(this.playerID)
this.mg = mg
this.patrolCenterTile = mg.tile(this.cell)