mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-02 08:28:12 +00:00
created path finding web worker
This commit is contained in:
@@ -5,6 +5,7 @@ import { AttackExecution } from "./AttackExecution";
|
||||
import { TransportShipExecution } from "./TransportShipExecution";
|
||||
import { SpawnExecution } from "./SpawnExecution";
|
||||
import { PortExecution } from "./PortExecution";
|
||||
import { AsyncPathFinder, AsyncPathFinderCreator } from "../pathfinding/AsyncPathFinding";
|
||||
|
||||
export class FakeHumanExecution implements Execution {
|
||||
|
||||
@@ -21,7 +22,7 @@ export class FakeHumanExecution implements Execution {
|
||||
|
||||
private relations = new Map<Player, number>()
|
||||
|
||||
constructor(private playerInfo: PlayerInfo, private cell: Cell, private strength: number) {
|
||||
constructor(private asyncPathFinder: AsyncPathFinderCreator, private playerInfo: PlayerInfo, private cell: Cell, private strength: number) {
|
||||
this.random = new PseudoRandom(simpleHash(playerInfo.id))
|
||||
}
|
||||
|
||||
@@ -151,7 +152,7 @@ export class FakeHumanExecution implements Execution {
|
||||
const oceanTiles = Array.from(this.player.borderTiles()).filter(t => t.isOceanShore())
|
||||
if (oceanTiles.length > 0) {
|
||||
const buildTile = this.random.randElement(oceanTiles)
|
||||
this.mg.addExecution(new PortExecution(this.player.id(), buildTile.cell()))
|
||||
this.mg.addExecution(new PortExecution(this.player.id(), buildTile.cell(), this.asyncPathFinder))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user