mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-30 06:19:41 +00:00
nukes spawn from missile silos
This commit is contained in:
@@ -80,6 +80,8 @@ export class UnitLayer implements Layer {
|
||||
break;
|
||||
case UnitType.TradeShip:
|
||||
this.handleTradeShipEvent(event)
|
||||
case UnitType.Nuke:
|
||||
this.handleNuke(event)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +95,17 @@ export class UnitLayer implements Layer {
|
||||
.forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.unit.owner().info()), 180));
|
||||
}
|
||||
|
||||
private handleNuke(event: UnitEvent) {
|
||||
bfs(event.oldTile, euclDist(event.oldTile, 2)).forEach(t => {
|
||||
this.clearCell(t.cell());
|
||||
});
|
||||
if (event.unit.isActive()) {
|
||||
bfs(event.unit.tile(), euclDist(event.unit.tile(), 2))
|
||||
.forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.unit.owner().info()), 255));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private handleTradeShipEvent(event: UnitEvent) {
|
||||
bfs(event.oldTile, euclDist(event.oldTile, 1)).forEach(t => {
|
||||
this.clearCell(t.cell());
|
||||
@@ -130,6 +143,7 @@ export class UnitLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
paintCell(cell: Cell, color: Colord, alpha: number) {
|
||||
const index = (cell.y * this.game.width()) + cell.x;
|
||||
const offset = index * 4;
|
||||
|
||||
Reference in New Issue
Block a user