migrate from perforce
This commit is contained in:
27
dist/Simulation/Commands/SimCommandBlockTerrain.js
vendored
Normal file
27
dist/Simulation/Commands/SimCommandBlockTerrain.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Hex } from "../../Util/index.js";
|
||||
import { ECellType } from "../index.js";
|
||||
export class SimCommandBlockTerrain {
|
||||
_hex;
|
||||
_simLevel;
|
||||
constructor(level, hex) {
|
||||
this._hex = hex;
|
||||
this._simLevel = level;
|
||||
}
|
||||
execute() {
|
||||
const simLevel = this._simLevel;
|
||||
const cellIndex = simLevel.getCellIndex(this._hex);
|
||||
const cell = simLevel.simCells[cellIndex];
|
||||
if (cell.type != ECellType.Free || cell.simTower != null || !simLevel.reservePaths(this._hex)) {
|
||||
return;
|
||||
}
|
||||
cell.type = ECellType.Blocked;
|
||||
simLevel.updateBlockedType(cell);
|
||||
for (let i = 0; i < 6; ++i) {
|
||||
const neighbourHex = Hex.neighbour(cell.hex, i);
|
||||
const neighbourIndex = simLevel.getCellIndex(neighbourHex);
|
||||
simLevel.updateBlockedType(simLevel.simCells[neighbourIndex]);
|
||||
}
|
||||
simLevel.updatePaths();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=SimCommandBlockTerrain.js.map
|
||||
Reference in New Issue
Block a user