Introduction
This mod allows you to define train routes, and assign multiple trains to these routes.
When your route changes, the train-schedules of the trains following this route, will be updated.
This mod is useful when using groups of trains with identical schedules, which need to be coordinated.
It differs from the regular copy-pasting schedules, by keeping the schedules of multiple trains in sync.
How it works
A train route is defined by creating a stationary-train, in which you specify your route (as a typical schedule).
This train will be parked at a typical station that holds the name of the route, namely, 'Route: [fill in your route name]'.
* Note that the 'Route: ' prefix is mandatory, as it is recognized by the mod.
The first destination (station) of the route of the stationary-train should be the name of the aforementioned station.
You assign any train to a route by clearing its schedule and setting the destination to the station.
Demonstration video
- See the centralized train routes in action: https://www.youtube.com/watch?v=aWyUQRaxfi4 (simple setup with 4 stations and 3 trains)
Defining a route
To give an example, I assume you have two operational stations named 'Iron patch', and 'Iron smelters'
- Create a piece of track anywhere of, say, 3 segments long (just enough to hold a station and a train)
- Create a station on this track, named 'Route: Transport iron ore to smelter'
Place a train on this track (add some fuel, to stop the empty-fuel blinking warning), this train will never drive anywhere, it's solely used to configure and manage your route.
- Add the station 'Route: Transport iron ore to smelter' to its schedule (this is mandatory, it must be first)
- Add the station 'Iron patch' to its schedule (configure the wait-conditions as desired)
- Add the station 'Iron smelters' to its schedule (configure the wait-conditions as desired)
Your new route is now configured.
Assigning a train to your route
- Select a train.
- Clear its schedule.
- Add the station 'Route: Transport iron ore to smelter' to its schedule.
That's all! Within a second you'll see that the schedule is filled with the route we defined earlier.
The train will now follow this route. To detach this train from the route, simply clear its schedule.
Changing a route
Simply change the schedule of the stationary-train, and all trains following the route will have their schedules updated.
- The mod will notify you how many train-schedules were updated, giving you feedback on what happened behind the scenes.
- As to prevent your trains picking up intermediate changes while you're working on your route - the mod will only change the schedules of the group of trains, once the most recent change was made a few seconds ago.
- Note that not only the schedule, but also the color of the train is synchronized among all trains following the same route.
Notes
It may seem a little contrived to use a dummy station and a dummy train to define a route, but the upshot is that we can reuse all UI-elements that already exist in Factorio, without introducing or changing any UI. The drawback is that the player has to be aware of the 'convention' of the 'Route: ' prefix, and has to jump through minor hoops, but after you did it once or twice, it hopefully will feel native to the game. I played Factorio with my own mod for at least a hundred hours. I allocate a small piece of land to have a few grids of 3-track rails with stations, which almost feel like a controlpanel: managing the schedules of dozens of trains from a single point in the base.
Changelog
- Version 0.1.9: Added safe-guard to prevent flipping the train-direction while train is on route
- Version 0.1.8: Fixed - Adjusting the route no longer triggers all trains to head to the first station in their updated schedule.
Feedback
If you have ideas on how to improve this mod, please let me know. All feedback is welcome for that matter!
My other train-mods can be found here, they play well together: https://mods.factorio.com/user/riven8192