Train teleporter [BETA]

by Jorn86

Allows you to teleport any train from one stop to another

6 months ago
0.18
123
Owner:
Jorn86
Source:
jorn86/factorio-mods
Homepage:
https://github.com/jorn86/factorio-mods
License:
MIT
Created:
8 months ago
Latest Version:
0.0.3 (6 months ago)
Factorio version:
0.18
Downloaded:
123 times

Train Teleporter [BETA]

This mod allows you to teleport trains across the map, and even to different surfaces.
Do you want to build train stations inside Factorissimo buildings? Have trains travel between planets in Space Exploration?
Or just have your trains arrive sooner? With this mod, you can do all of it!

Since the actual teleportation of trains is not supported in the Factorio engine, this mod is a hack. There is no guarantee about continued support, stability or development.

Usage

To teleport a train, you need to define a stop in its schedule with exactly one condition: A Circuit-type condition, where
the first signal is the custom signal "Teleport train" added by this mod.
The train will teleport to the next station in its schedule as soon as it arrives at that stop.

It is also possible to skip a number of stops, using the second signal of the condition.
You can either set it to a constant number to always skip that number of stops, or select a signal
which will be evaluated against the train stop (not against the train itself, so no need to enable "Send to train" on the stop).

Remote interface & custom events

This mod raises a custom event when a train is teleported. To subscribe to the event, add this code in your mod:

script.on_event(remote.call('train-teleporter', 'get_events').train_teleported, function(event)
    print('train id before teleport = ' .. event.from)
    print('train id before teleport = ' .. event.to)
    -- use old and new train ids here. Note that the train with the from id probably doesn't exist any more.
end)