only send messages related to player

This commit is contained in:
evanpelle
2024-09-21 12:16:37 -07:00
parent 7799e76ef8
commit a622ff4a1b
4 changed files with 22 additions and 6 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ export class BoatAttackExecution implements Execution {
this.attacker = mg.player(this.attackerID)
if (this.attacker.boats().length >= mg.config().boatMaxNumber()) {
mg.displayMessage(`No boats available, max ${mg.config().boatMaxNumber()}`, MessageType.WARN)
mg.displayMessage(`No boats available, max ${mg.config().boatMaxNumber()}`, MessageType.WARN, this.attackerID)
this.active = false
this.attacker.addTroops(this.troops)
return
@@ -78,7 +78,7 @@ export class BoatAttackExecution implements Execution {
return
}
if (manhattanDistWrapped(this.src.cell(), this.dst.cell(), mg.width()) > mg.config().boatMaxDistance()) {
mg.displayMessage(`Cannot send boat: destination is too far away`, MessageType.WARN)
mg.displayMessage(`Cannot send boat: destination is too far away`, MessageType.WARN, this.attackerID)
this.active = false
return
}
+1 -1
View File
@@ -182,7 +182,7 @@ export interface Game {
inSpawnPhase(): boolean
addExecution(...exec: Execution[]): void
config(): Config
displayMessage(message: string, type: MessageType): void
displayMessage(message: string, type: MessageType, playerID: PlayerID | null): void
}
export interface MutableGame extends Game {