Now you can connect/disconnect trains through the magic of circuits!
This mod adds two new virtual signals, couple and uncouple. When a train stops at a station receiving either (or both!) of these signals, it will attempt to couple and/or uncouple the train accordingly. If a station is receiving both signals, it will attempt to couple first, then uncouple.
Coupling/uncoupling only occurs when a train arrives at a station - if a train is already at the station when you send the signal, nothing will happen.
Note that these signals are only read by stations, and only work for trains under automatic control that stop at a station.
Coupling
If greater than zero, attempts to connect the train to another train in front of it. If less than zero, attempts to connect behind (I guess it's theoretically possible you could get this to work, with very careful timing)
Uncoupling
If greater than zero, disconnects that many cars from the front of the train, and if less than zero disconnects that many from the rear of the train. If the uncouple value is greater (positive or negative) than the number of wagons in the train, nothing happens. For example, "uncouple 1" will disconnect the lead wagon, "uncouple -1" will disconnect the trailing wagon.
Example
The train will travel from A to C, where it will immediately uncouple the first wagon (counting from the station), as instructed by the signal of "uncouple 1". The two locomotives will then immediately travel back to A.
From A the locomotives will move to B, where they will connect to the train in front of them, as instructed by the signal "couple 1". The train (two locomotives plus cargo wagon) will then immediately travel back to A.
Known Issues
If a train is successfully coupled or uncoupled, it will immediately depart for the next station on its schedule. This is unfortunately unavoidable. Changing the composition of a train resets it to manual control, and if it is not advanced to the next station on its schedule it will either fail to path (trains can't find a path to the station they're already at) or it will attempt to visit the same station again (and possibly trigger another uncouple).
Version History
- 1.0.0 - 2017/05/25 - Initial release