Page 1 of 1

Beginner question about trains

Posted: Sat Apr 27, 2019 3:48 pm
by lynce
Probably been asked and anwered before, but here goes..
I have a rail line with two mining outposts stations and a base station. Is it possible to have the train go back to base If cargo is full instead of having to travel to the second outposts before base again?

Re: Beginner question about trains

Posted: Sat Apr 27, 2019 4:26 pm
by Amarula
No simple way in the train schedule to add conditions for going (or not going) to a station.
However, stations can be disabled by the circuit network. So it would be possible to read the train contents, and set a circuit condition to disable the outpost stations when the train is full, which would result in the train heading back to base. You would need to run circuit wires from the base to both stations, so you could clear the condition to disable the outposts when the train at the base becomes empty.
So it is possible, but in my opinion, it is a lot of tedious work for little gain. I would just let the train run to the second station and say "oh I am full already" and keep going back to your base.
Have fun!

Re: Beginner question about trains

Posted: Sat Apr 27, 2019 4:41 pm
by Durentis
Don't read the train contents for this.. it doesn't scale.

Give all of your copper loading stations the same name, such as "> Ore Copper", and your unload station something like "< Ore Copper". (I'm using ">" to mean "get" and "<" to mean "put" and the word ordering is for sorting.)

With that, you just have to set your train with two stations:
1) "> Ore Copper" until cargo full
2) "< Ore Copper" until cargo empty

Wire up the chests at "> Ore Copper" stations and set the station to enabled if there is enough copper in the chests to fill each wagon in your train. If there isn't enough, the station needs to be disabled (or entrance to the station by disabling a signal) to prevent the train from going to it. As long as you have enough "> Ore Copper" stations, there should always be at least one enabled with enough to fill a train. Trains set to go to "> Ore Copper" will path to the nearest enabled one automatically.

Same idea with other items being transported, except "> Ore Iron", "> Oil", ...

You can potentially experience some "orphan trains" with this method occasionally where trains will have nowhere to go and back up your rails. Solving that problem requires more complicated circuitry (see my sig for one idea). But this method should be more than good enough for your needs for a long while.

Re: Beginner question about trains

Posted: Sat Apr 27, 2019 5:18 pm
by lynce
I see. Thanks guys:)

Re: Beginner question about trains

Posted: Sun Apr 28, 2019 2:12 am
by zOldBulldog
The best way to do somewhat intelligent routing seems to be with the LTN mod. With it trains will sit empty at a parking "depot" until a station signals that it needs materials... then the train goes where it can get the materials, load them, then go deliver them, and once empty it goes back to the depot.