This mod was inspired by KatherineOfSky who wanted special behavior for her "builder" trains, see Factorio Entry Level to Megabase 7, Ep 20.
Train stations with the question mark character as the first and/or last character of their name are "optional". If such a station cannot be reached from the current station (either no path, or all of the same name are all full / disabled), then the train will simply ignore it and go to the next named station on the schedule.
This mod is different from other existing mod(s) that try to accomplish something similar, in that it does not alter the schedule in any way. It merely watches the schedule (read-only) and changes how the game moves through it.
Stations may be enabled/disabled the conventional ways, with circuits or via train limits.
There are a lot of present limitations to this mod:
-
It requires the train schedule to have at least two stops. One can't skip a stop if there is only a single stop on the schedule.
-
It requires at least one train stop in the schedule to always be reachable. It works better (less game impact) if more than one train stop is reachable. An annoying thing happens when only one stop is reachable, every such train oscillates between waiting and arriving at the same station every alternate tick*.
-
It requires each stop to have a wait condition. The wait condition can be as simple as wait for 0 seconds of inactivity, or any other desired wait condition. In other words, there needs to be a reason for the train to actually stop at the station. Without a wait condition, a train will sail right through at high speed.
-
It requires a train to start from a station in the schedule. There could be cases where it will not go to the right station if a train starts away from a station and switches from manual mode to automatic.
-
Bidirectional trains haven't been tested.
Tested with SpaceAge, but should work just as well/poorly with vanilla Factorio 2.0.
Contributors: Shemp provided the code changes to support Multiplayer without desyncing. THANK YOU!
- Note Shemp also provided a patch to change this behavior, but it modifies the schedule by introducing a temporary stop. I do not plan to include this patch until I update the mod to make it something that can be enabled/disabled via a user-controlled mod option.