Auto-Build Railways

If you liked this item, please rate it up on Steam Workshop page.

Author: Vezachs

Last revision: 2 Nov, 2022 at 22:49 UTC

File size: 722.94 KB

On Steam Workshop

Description:
Never manually expand your railways again!

If God had intended us to fly, he’d have never given us railways.
– Michael Flanders

This mod aims at making railway expansion smarter! Now, railways will auto-expand whenever market access is below 100%; or, the building has a lot of potential to make money by selling transportation. Of course, all of this only works when you have auto-expand turned on.

Auto-build only works when the building is either subsidized, or cash reserves are at 0.75!

Version compatability

This mod was built for version 1.0.4, but should work on any (future) version of the game, as the adjustments to the files are very minor.

Mod compatability

This mod works as a standalone.
This mod is compatible with most mods (most notably Anbeeld’s AI and Improved Automation).

If you use ‘Anbeeld’s Revision of AI’ and/or ‘Improved Automation’,
Put those mods in the following order to prevent bugs:
1. Anbeeld’s Revision of AI
2. Improved Automation
3. Auto Build Railways

Version History

1.0 : Mod created.
1.1 : Increased min. profit of the railway from 1 to 10, to prevent runaway railway construction.

Code

Credit goes to the Anbeeld’s revision of AI mod!
Note the most important change relative to the Improved Automation mod is the < changed into <= , as the game doesn’t understand what < means. This is apparently bugged in Paradox Games.

############ PRIVATE INFRASTRUCTURE

building_railway = {
building_group = bg_private_infrastructure
texture = "gfx/interface/icons/building_icons/building_railway.dds"

unlocking_technologies = {
railways
}

production_method_groups = {
pmg_base_building_railway
pmg_passenger_trains
pmg_armored_trains
}

required_construction = construction_cost_high

should_auto_expand = {
OR = {
cash_reserves_ratio > 0.75
is_subsidized = yes
}
OR = {
state.market_access <= 0.999
AND = {
weekly_profit > 10
state = {
cb_state_has_free_workforce = yes
}
}
}
}
owner.construction_queue_duration < 150
}
}