mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-04 11:26:07 +00:00
have client create player id
This commit is contained in:
@@ -39,6 +39,7 @@ export class BotSpawner {
|
||||
}
|
||||
return {
|
||||
type: 'spawn',
|
||||
playerID: this.random.nextID(),
|
||||
name: botName,
|
||||
playerType: PlayerType.Bot,
|
||||
x: tile.cell().x,
|
||||
|
||||
@@ -34,7 +34,7 @@ export class Executor {
|
||||
)
|
||||
} else if (intent.type == "spawn") {
|
||||
return new SpawnExecution(
|
||||
new PlayerInfo(intent.name, intent.playerType, intent.clientID, this.random.nextID()),
|
||||
new PlayerInfo(intent.name, intent.playerType, intent.clientID, intent.playerID),
|
||||
new Cell(intent.x, intent.y)
|
||||
)
|
||||
} else if (intent.type == "boat") {
|
||||
|
||||
@@ -24,7 +24,7 @@ export class SpawnExecution implements Execution {
|
||||
return
|
||||
}
|
||||
|
||||
const existing = this.mg.players().find(p => p.clientID() != null && p.clientID() == this.playerInfo.clientID)
|
||||
const existing = this.mg.players().find(p => p.id() == this.playerInfo.id)
|
||||
if (existing) {
|
||||
existing.tiles().forEach(t => existing.relinquish(t))
|
||||
getSpawnCells(this.mg, this.cell).forEach(c => {
|
||||
|
||||
Reference in New Issue
Block a user