Factory spawns trains (#1408)

## Description:

- Change trains so it spawns from factories only
- Increase train frequency as they will now spawn from a single
structure.
- Factory will spawn more trains depending on its level
- Fix port to connect to nearby railroads
- Add factory description

## 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
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

IngloriousTom

---------

Co-authored-by: Tom Rouillard <trouilla@mathworks.com>
Co-authored-by: evanpelle <evanpelle@gmail.com>
This commit is contained in:
DevelopingTom
2025-07-14 17:59:51 +02:00
committed by GitHub
parent 1e73293d4f
commit 29b587cdae
7 changed files with 74 additions and 31 deletions
+2 -9
View File
@@ -45,20 +45,13 @@ class PortStopHandler implements TrainStopHandler {
}
class FactoryStopHandler implements TrainStopHandler {
private factor: bigint = BigInt(2);
onStop(
mg: Game,
station: TrainStation,
trainExecution: TrainExecution,
): void {
const goldBonus = mg.config().trainGold();
station.unit.owner().addGold(goldBonus);
mg.addUpdate({
type: GameUpdateType.BonusEvent,
tile: station.tile(),
gold: Number(goldBonus),
workers: 0,
troops: 0,
});
station.unit.owner().addGold(mg.config().trainGold(), station.tile());
}
}