Improve TribeExecution deleteAllStructures 🏛️ (#3777)

## Description:

`deleteAllStructures` did not check for `isMarkedForDeletion`, not very
clean. Now its clean.
Also rename to `deleteNextStructure` because its not possible to delete
more than 1 structure at a time.

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

FloPinguin
This commit is contained in:
FloPinguin
2026-04-27 03:10:27 +02:00
committed by GitHub
parent 8099b9fad7
commit 408d0e4862
+7 -5
View File
@@ -60,7 +60,7 @@ export class TribeExecution implements Execution {
}
this.acceptAllAllianceRequests();
this.deleteAllStructures();
this.deleteNextStructure();
this.maybeAttack();
}
@@ -83,11 +83,13 @@ export class TribeExecution implements Execution {
}
}
private deleteAllStructures() {
private deleteNextStructure() {
if (!this.tribe.canDeleteUnit()) return;
for (const unit of this.tribe.units()) {
if (Structures.has(unit.type()) && this.tribe.canDeleteUnit()) {
this.mg.addExecution(new DeleteUnitExecution(this.tribe, unit.id()));
}
if (!Structures.has(unit.type())) continue;
if (unit.isMarkedForDeletion()) continue;
this.mg.addExecution(new DeleteUnitExecution(this.tribe, unit.id()));
return;
}
}