mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-02 12:58:09 +00:00
created PlayerType enum add FakeHuman type
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {Cell, Game, Tile, TileEvent} from "../Game";
|
||||
import {Cell, Game, PlayerType, Tile, TileEvent} from "../Game";
|
||||
import {PseudoRandom} from "../PseudoRandom";
|
||||
import {SpawnIntent} from "../Schemas";
|
||||
import {bfs, dist as dist, manhattanDist} from "../Util";
|
||||
@@ -40,7 +40,7 @@ export class BotSpawner {
|
||||
return {
|
||||
type: 'spawn',
|
||||
name: botName,
|
||||
isBot: true,
|
||||
playerType: PlayerType.Bot,
|
||||
x: tile.cell().x,
|
||||
y: tile.cell().y
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ export class Executor {
|
||||
)
|
||||
} else if (intent.type == "spawn") {
|
||||
return new SpawnExecution(
|
||||
new PlayerInfo(intent.name, intent.isBot, intent.clientID, this.random.nextID()),
|
||||
new PlayerInfo(intent.name, intent.playerType, intent.clientID, this.random.nextID()),
|
||||
new Cell(intent.x, intent.y)
|
||||
)
|
||||
} else if (intent.type == "boat") {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Cell, Execution, MutableGame, MutablePlayer, PlayerInfo} from "../Game"
|
||||
import {Cell, Execution, MutableGame, MutablePlayer, PlayerInfo, PlayerType} from "../Game"
|
||||
import {BotExecution} from "./BotExecution"
|
||||
import {PlayerExecution} from "./PlayerExecution"
|
||||
import {getSpawnCells} from "./Util"
|
||||
@@ -41,7 +41,7 @@ export class SpawnExecution implements Execution {
|
||||
player.conquer(this.mg.tile(c))
|
||||
})
|
||||
this.mg.addExecution(new PlayerExecution(player.id()))
|
||||
if (player.isBot()) {
|
||||
if (player.type() == PlayerType.Bot) {
|
||||
this.mg.addExecution(new BotExecution(player))
|
||||
}
|
||||
this.active = false
|
||||
|
||||
Reference in New Issue
Block a user