Diverter Stations


Adds a train station that will interrupt all attending trains, sending them to a temporary destination station before continuing their schedule.

Utilities
4 months ago
1.1
63
Trains

g use case?

4 months ago

what's a good use case for such a mod? or how do you see it being used?/primary reason for making the mod? Adding that to description will help

4 months ago

What this mod lets you do is allow certain train stops on a train's schedule to act like variables that can change depending on where in the rail system the train is.

Say you have three largely independent train networks, Network A, Network B, and Network C. Within each network, trains can move around freely. Trains can also hop from one network to the other, but only through special one-way bridges that are accessed by routing through special train stops.

If you wanted to create a schedule that looked something like this:

  • Pick up iron ore in Network A
  • Drop off iron ore in Network A
  • Bridge to Network B
  • Pick up iron ore in Network B
  • Drop off iron ore in Network B
  • Bridge to Network C
  • Pick up iron ore in Network C
  • Drop off iron ore in Network C
  • Bridge to Network A and repeat cycle

...the schedule would have to look pretty much exactly like that. You'd have to hard-code the pattern of network hops the train would need to take, in order. The more network hops you add, the longer the schedule gets. And It's always tied down to that specific order.

With this Diverter Stations mod, you could instead simplify the train schedule to:

  • Pick up iron ore
  • Drop off iron ore
  • Go to a diverter stop (it will say where to go next, you'll find out when you get there)

If the train is already in Network A, it will pick up, drop off, and go to a diverter. That diverter could point the train to bridge to Network B. It will repeat the pick up/drop off cycle there, go to another diverter, and that diverter could point to the bridge to Network C. Or, the diverter could point the train back to B. Or it could point nowhere, keeping the train in C. The train doesn't need to know at any point what network it actually needs to bridge to next. You abstract that away to "ask the diverter stop", and the train will get a potentially different answer depending on the next diverter stop it happens to find.

This allows for a high degree of flexibility in such a system with minimal circuit network jank and simpler train schedules. You're effectively baking part of the schedule into the track itself.

Alternatively, you could have diverter stops named the same thing as regular stops on the schedule. Then, if a train somehow manages to find its way to this doppelgänger stop, the diverter can say, "go do <X> instead this time". Kind of like a poor man's interrupt, that feature the devs will be adding soon in Factorio's upcoming 1.2 update.

The ability to force a diverter to ignore all stop conditions is for special cases where, say, you want the diverter to be a doppelgänger of an iron ore pickup, even though the diverter has no actual iron ore to be picked up. Without the override, the train would get to the diverter and never leave, waiting for cargo that will never come. With the override, the diverter can force the train to proceed without picking up anything.

If you are wondering, "why on earth would you lay out your rail network like that, that sounds awful," the answer is "because Space Exploration". The "networks" are the surfaces of planets and moons, and the "bridges" are space elevators and spaceships. Without diverters, we have to program long train schedules that explicitly account for every surface the train visits in sequence. With diverters, we can say "pick up, drop off, ask a diverter", and on every loop, trains will happily climb up or down a space elevator, or hop onto a spaceship waiting to take it somewhere, all without caring what any of those train stop are actually named. It lets the trains target a new stop with a new name every loop without forcing us to name all of these stops the same thing (which, in the case of SE's space elevators, you can't do even if you wanted to, as it always adds an up or down arrow to the end of the stop's name when you rename it). The doppelgänger feature also lets us do something like, "pick up ore, go through fake dropoff, divert to another planet, go through fake pickup, drop off ore, divert back to home planet". Trains can quietly do interplanetary resource delivery to arbitrary planets with no extra programming.

The mod isn't marked as being "for" Space Exploration because you COULD use it in vanilla. For what? I dunno. It's very powerful. I'm sure someone will come up with something. But simplifying logistics in Space Exploration was what we wanted it for.

Everything this mod can do can technically be achieved with a very clever circuit network arrangement and a carefully planned maze of circuit-controlled train stops. Ask us how we know, lmao. However, having all of these features condensed into a single entity that does it all without any fuss is a major time, stress, and UPS saver.

3 months ago

Interesting mod. I understand your use case. I think what is missing is a circuit condition for the train diverter to do it's thing or not. Right now you have to enable or disable the whole station (which works but is messy)

My use case would be a diverter station that checks the content of a train and depending on it sends the train to another station or not.

New response