diff --git a/src/client/graphics/layers/EventsDisplay.ts b/src/client/graphics/layers/EventsDisplay.ts index 6ead87bf5..db1dcabb4 100644 --- a/src/client/graphics/layers/EventsDisplay.ts +++ b/src/client/graphics/layers/EventsDisplay.ts @@ -11,7 +11,8 @@ import { Game, Player, PlayerID, - TargetPlayerEvent + TargetPlayerEvent, + UnitEvent } from "../../../core/game/Game"; import { ClientID } from "../../../core/Schemas"; import { Layer } from "./Layer"; diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index a36a8b23f..f6371d1d5 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -31,18 +31,15 @@ export const devConfig = new class extends DefaultConfig { tradeShipSpawnRate(): number { return 10 } - // boatMaxDistance(): number { - // return 5000 - // } + boatMaxDistance(): number { + return 5000 + } - // numBots(): number { - // return 0 - // } - // spawnNPCs(): boolean { - // return false - // } + numBots(): number { + return 0 + } + spawnNPCs(): boolean { + return false + } - // boatMaxDistance(): number { - // return 2000 - // } } \ No newline at end of file diff --git a/src/core/execution/MissileSiloExecution.ts b/src/core/execution/MissileSiloExecution.ts index b341c75ff..5142eb21e 100644 --- a/src/core/execution/MissileSiloExecution.ts +++ b/src/core/execution/MissileSiloExecution.ts @@ -28,12 +28,6 @@ export class MissileSiloExecution implements Execution { } this.silo = this.player.buildUnit(UnitType.MissileSilo, 0, tile) } - - if (!this.silo.tile().hasOwner()) { - this.silo.delete() - this.active = false - return - } } owner(): MutablePlayer { diff --git a/src/core/game/UnitImpl.ts b/src/core/game/UnitImpl.ts index 804685957..85b34f548 100644 --- a/src/core/game/UnitImpl.ts +++ b/src/core/game/UnitImpl.ts @@ -1,3 +1,4 @@ +import { MessageType } from "../../client/graphics/layers/EventsDisplay"; import { simpleHash } from "../Util"; import { MutableUnit, Tile, TerraNullius, UnitType, Player, UnitInfo } from "./Game"; import { GameImpl } from "./GameImpl"; @@ -46,14 +47,26 @@ export class UnitImpl implements MutableUnit { } setOwner(newOwner: Player): void { + const oldOwner = this._owner this._owner = newOwner as PlayerImpl this.g.fireUnitUpdateEvent(this, this.tile()) + this.g.displayMessage( + `Your ${this.type()} was captured by ${newOwner.displayName()}`, + MessageType.ERROR, + oldOwner.id() + ) } delete(): void { + if (!this.isActive()) { + throw new Error(`cannot delete ${this} not active`) + } this._owner._units = this._owner._units.filter(b => b != this); this._active = false; this.g.fireUnitUpdateEvent(this, this._tile); + if (this.type() != UnitType.AtomBomb && this.type() != UnitType.HydrogenBomb) { + this.g.displayMessage(`Your ${this.type()} was destroyed`, MessageType.ERROR, this.owner().id()) + } } isActive(): boolean { return this._active;