don't delete nukes when player dies. was creating a an error because nukeexecution tried deleting inactive unit.

This commit is contained in:
Evan
2024-12-26 09:56:12 -08:00
parent 2771d3d432
commit fa3b3478b7
2 changed files with 6 additions and 5 deletions
-3
View File
@@ -108,9 +108,6 @@ export class NukeExecution implements Execution {
}
}
}
// this.mg.units()
// .filter(b => euclideanDist(this.cell, b.tile().cell()) < this.magnitude + 50)
// .forEach(b => b.delete())
this.active = false
this.nuke.delete(false)
}
+6 -2
View File
@@ -1,5 +1,5 @@
import { Config } from "../configuration/Config"
import { Execution, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile } from "../game/Game"
import { Execution, MutableGame, MutablePlayer, Player, PlayerID, TerraNullius, Tile, UnitType } from "../game/Game"
import { bfs, calculateBoundingBox, getMode, inscribed, simpleHash } from "../Util"
import { GameImpl } from "../game/GameImpl"
import { consolex } from "../Consolex"
@@ -48,7 +48,11 @@ export class PlayerExecution implements Execution {
})
if (!this.player.isAlive()) {
this.player.units().forEach(u => u.delete())
this.player.units().forEach(u => {
if (u.type() != UnitType.AtomBomb && u.type() != UnitType.HydrogenBomb) {
u.delete()
}
})
this.active = false
return
}