Train Network for Players

by leeh

QoL and advanced functionality for players using trains for transport, including improved destination selection dialog and automated train calling.

Content
2 years ago
0.17 - 1.1
7.37K
Transportation
Owner:
leeh
Source:
https://github.com/leehuk/factorio-tnfp
Homepage:
https://leehuk.github.io/factorio-tnfp/
License:
MIT
Created:
5 years ago
Latest Version:
0.12.6 (2 years ago)
Factorio version:
0.17 - 1.1
Downloaded by:
7.37K users

Train Network for Players (Factorio Mod)

About

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:

  • When onboard a train, provide the ability to go to any train stop (or even just a rail segment) easily and without manually modifying schedules.
  • Allow one (or more) trains to be designated for player use, which can then be automatically dispatched to wherever the player is. In effect, player trains become more like taxis.

Station Select Dialog

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:


  • Selecting a station will temporarily add it to the trains schedule and dispatch the train there, where it will wait for the player to exit before resuming its previous schedule.
  • Quickly filter between stations in the trains schedules, TNfP designated stations or all stations. Mod setting controls the default.
  • Filter the list of stations further via the search bar.
  • Submit the search bar with enter, and the first station in the list will be selected.
  • Home stations can be pinned to the very top of the 'all stations' and 'tnfp stations' lists via a circuit signal.
  • Any station can be pinned to the top of the 'all stations' list via the GUI.
  • The railtool button will provide a railtool and open the map, allowing the train to be dispatched to any valid rail segment.

TNfP Network

If one or more trains are assigned into a TNfP network they can be automatically dispatched to the players location using the two shortcuts:

  • Request TNfP Train (default ALT-P) will dispatch a train to the nearest valid train stop. If a request is active, selecting it again will cancel the request.
  • Provide TNfP Rail Tool (default SHIFT-ALT-P) will provide a railtool under the cursor, which can be used to select a rail segment to create a temporary stop.
  • Provide TNfP Rail Tool and Open Map (no default) will provide a railtool under the cursor and open the map.

Misc

Miscellaneous features:

  • Adds a custom input control for switching the current train to manual mode. This also works for a train which has just arrived after dispatch.

TNfP Network Creation

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:
1. Research trains, train stops and the circuit network.
1. Have a train stop thats only intended for player use.
1. Have a train thats only intended for player use, with the player train stop anywhere in its schedule.
1. Place a Constant Combinator near your personal train stop.
1. Set the combinator to output the new 'TNfP Station' virtual signal (with any value) -- found under 'Signals'.
1. Connect the combinator to the train stop, with either red or green wire.

When dispatching trains TNfP will find the nearest train which has anywhere in its schedule a train stop receiving the 'TNfP Station' signal.

TNfP Rail Tool

The railtool provides a way of creating temporary train stops and is used by selecting/dragging over an area containing rail segments, from either the standard player view or map view:


 

  • If a valid train stop is found, that is used for dispatch. If a valid train stop is found, a new temporary stop will be created at that location.
  • When onboard a train the destination is temporarily added to the trains schedule and dispatched there.
  • When not onboard a train a player train will be dispatched there from the TNfP network.
  • When used in alternate mode (by holding shift), the trains arrival behaviour will change so that it instead switches to manual mode instead of resuming its schedule.
  • To remove a rail tool from your inventory, drop it on the ground near the player (default 'z') and it will be automatically destroyed.

TNfP Home Station

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.

Important Notes

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:

  • LTN (Logistic Train Network): TNfP will dispatch to any stop except depots, which are ignored due to conflicts with scheduling trains. (Thanks to Optera for assistance).
  • TSM (Train Supply Manager): TNfP will completely ignore TSM stops. Suppliers conflict by altering trains schedules, and requesters conflict as TNfP interferes with the train counter logic.
  • Default: TNfP uses a configuration option controlling whether stops are considered safe to dispatch to (and thus ignored) or not.