migrate from perforce

This commit is contained in:
2026-04-19 01:16:27 +02:00
commit d161a20915
1810 changed files with 1156171 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import { Hex } from "../../Util/index.js";
import { ECellType, SimTower } from "../index.js";
export class SimCommandCreateTower {
_hex;
_simLevel;
_index;
_gdRoot;
constructor(game, level, hex, index) {
this._gdRoot = game;
this._hex = hex;
this._simLevel = level;
this._index = index;
}
execute() {
const level = this._simLevel;
const cellIndex = level.getCellIndex(this._hex);
const cell = level.simCells[cellIndex];
const towerData = this._gdRoot.towers[this._index];
if (cell.type != ECellType.Free) {
return;
}
if (cell.simTower != null) {
return;
}
level.simEnemies.forEach((enemy) => {
const hex = Hex.fromWorld(enemy.position);
const enemyCellIndex = level.getCellIndex(hex);
if (cellIndex == enemyCellIndex) {
return;
}
});
if (level.currency < towerData.cost) {
return;
}
if (level.reservePaths(this._hex)) {
level.currency -= towerData.cost;
cell.simTower = new SimTower(this._gdRoot, level, this._index, this._hex);
level.updatePaths();
}
}
}
//# sourceMappingURL=SimCommandCreateTower.js.map