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