Factorio Train Network for Players
QoL and advanced functionality for players using trains for transport, including improved destination selection dialog and automated train calling.
There are two core concepts for this mod:
The station select dialog provides a quick way of moving between stations and can be opened when onboard any train via either the input hotkey (ALT-P default) or toolbar shortcut:
If one or more trains are assigned into a TNfP network they can be automatically dispatched to the players location using the two shortcuts:
Miscellaneous features:
Trains are available for players if they have a train stop marked for TNfP use anywhere in their schedule, which is done via a single combinator signal.
To assign trains into a TNfP network:
When dispatching trains TNfP will find the nearest train which has anywhere in its schedule a train stop receiving the ‘TNfP Station’ signal.
The railtool provides a way of dispatching via the map or player view, with the ability to create a temporary train stop if needed. It’s used by selecting/dragging over an area containing train stations and/or rail segments:
The ‘TNfP Home Station’ is an additional circuit signal found under ‘Signals’. When this signal is provided to a train stop, that train stop becomes marked as a home station.
Home stations appear at the very top of the ‘all stations’ and ‘tnfp stations’ lists in the Station Select Dialog above pinned stations, allowing them to be quickly selected for dispatch.
This mod should be mostly stable for both single player and multiplayer. Bug reports, feature requests or any comments are preferred via github.com or via the forum. Please include the crash log and version information about both factorio and the mod in bug reports.
TNfP should be compatible with all mods relating to trains, providing they don’t change train schedules or add custom types of train stops. When used with mods which add custom types of train stops, TNfP will work as follows:
General technical information, for the curious.
When dispatching trains, TNfP will prioritise as follows:
If TNfP needs to dispatch a train to a player, it will dispatch the closest valid and unallocated train based on straight line distance.
TNfP will apply a configurable arrival timeout for the train to arrive at the requested location. If the train does not arrive before this timeout, the request will be cancelled and the train will have its original schedule restored.
The destination train stop for a TNfP dispatch request is added with a standard station wait condition, using a configurable time ‘Boarding Timeout’. If the player does not board in this time, TNfP will detect the train departing and restore its original schedule. If the player does board the train, it will immediately reset the schedule and perform the configurable ‘Boarding Behaviour’.
When a player boards a dispatched train, the original schedule is restored but the train is immediately switched to manual mode and so will not resume the schedule. If TNfP is configured to display the optional station selection dialog this will appear, allowing the player to select an onward destination.
If the station selection dialog is closed or the player exits the train, it will remain in manual mode but with its original schedule.
When a player has selected an onward destination, TNfP will add the new station with a standard station wait condition of ‘Passenger Not Present’. This station will then remain in the schedule until it becomes true (i.e. the passenger leaves the train), or the passenger selects another onward destination.
If the station is already in the trains schedule, the station wait conditions will not be altered. Additionally if it is a tnfp train and the redispatch station is already in the trains schedule, it will not resume its previous schedule on arrival but will instead remain at the redispatch station under its normal wait conditions.
TNfP relies on a particular quirk in factorio, in that once a train is waiting at a station – if the station is destroyed/deleted, factorio will continue to wait until the station condition is true before departing. This allows TNfP to clean up the temporary stations as early as possible, but with the caveat the schedule looks a little odd.