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

68
dist/Simulation/SimMain.js vendored Normal file
View File

@@ -0,0 +1,68 @@
import { SimActionFireTowers, SimActionMoveEnemies, SimActionMoveProjectiles, SimActionSpawnEnemies, SimCommandStartNextWave, SimLevel } from "./index.js";
export class SimMain {
_currentLevel;
_commands = [];
_actions = [];
_gdRoot;
constructor(gdRoot, level) {
this._gdRoot = gdRoot;
this._currentLevel = new SimLevel(gdRoot, level);
this._actions.push(new SimActionMoveEnemies());
this._actions.push(new SimActionSpawnEnemies());
this._actions.push(new SimActionFireTowers());
this._actions.push(new SimActionMoveProjectiles());
if (true || !this.loadModel()) {
this.reload();
}
this._currentLevel.paused = true;
}
get gdRoot() {
return this._gdRoot;
}
get currentLevel() {
return this._currentLevel;
}
executeUntilStep(targetStep) {
this.executeCommands();
while (this._currentLevel.currentStep < targetStep) {
this.executeOneStep();
this._currentLevel.currentStep += 1;
}
}
executeCommands() {
const saveModel = false && this._commands.length != 0;
this._commands.forEach((command) => {
command.execute();
});
this._commands = [];
if (saveModel) {
this.saveModel();
}
}
executeOneStep() {
for (const action of this._actions)
action.execute(this);
}
addCommand(command) {
this._commands[this._commands.length] = command;
}
reload() {
this._currentLevel = new SimLevel(this._gdRoot, 0);
this.saveModel();
this.addCommand(new SimCommandStartNextWave(this._gdRoot, this._currentLevel));
}
loadModel() {
if (!!localStorage.htd) {
const savedLevel = SimLevel.deserialize(this._gdRoot, localStorage.htd);
if (!savedLevel)
return false;
this._currentLevel = savedLevel;
return true;
}
return false;
}
saveModel() {
localStorage.htd = this._currentLevel.serialize();
}
}
//# sourceMappingURL=SimMain.js.map