Fix trainwreck bug (#1925)

Fixes #1922, the trainwreck bug.

- [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
This commit is contained in:
Scott Anderson
2025-08-24 20:51:26 -04:00
committed by evanpelle
parent 5a8eb65586
commit b0ec4c5558
+4 -6
View File
@@ -61,12 +61,10 @@ export class TrainStationExecution implements Execution {
}
private spawnTrain(station: TrainStation, currentTick: number) {
if (
!this.spawnTrains ||
currentTick - this.lastSpawnTick < this.ticksCooldown
) {
return;
}
if (this.mg === undefined) throw new Error("Not initialized");
if (!this.spawnTrains) return;
if (this.random === undefined) throw new Error("Not initialized");
if (currentTick < this.lastSpawnTick + this.ticksCooldown) return;
const cluster = station.getCluster();
if (cluster === null) {
return;