Page 1 of 1

Trains—Backup interrupts only when leaving station with signal

Posted: Sun May 17, 2026 1:53 pm
by foxoftheasterisk
This is a complicated one, but the gist of it is that I have stations I want my trains to go to as a backup if their first station choice is unavailable—but only if they're leaving a station that has a particular signal.

I thought this would be simple using the "Destination full" interrupt condition, but it turns out by the time this condition is triggered the train has left the station and thus does not receive signals. I'm trying to figure out if there's a way to make this work without sacrificing another feature of my rail system.
Full context
I'm playing with a modpack (it doesn't change how trains work) that has a focus on recipes with side products. Sometimes these are useful, but sometimes they're just waste that needs to be disposed of.

To handle this, I designed my rail system as a three tier system, like so:
  • Supply stations only ship to demand stations
  • Surplus stations ship to demand or recycling stations
  • Waste stations ship to demand, recycling, or disposal stations
It's very important that stations are always checked in the order of demand, then recycling, then disposal. It's also equally important that stations not ship to the wrong stations.

However, in order to facilitate a shared priority system, all three types of station are named the same generic "pickup" name. To differentiate the stations, they send signals to the stopped trains—A recycle symbol for the Surplus stations, and a trash signal for Waste stations. (Or, technically the Waste stations currently send both recycle and trash signals.)

The trains also use generic interrupts for dropoffs, rather than being dedicated to a particular type of cargo.

As I mentioned above, the plan was to use the "Destination full or no path" interrupt condition in combination with the "Circuit condition" condition to redirect the trains to recycle or trash stations, but that doesn't work because the circuit condition is no longer sent once the train has logically "left" the station (even though it's still physically "at" the station).

Solutions I've already considered:
  • Split the pickup station names (to Supply, Surplus, and Waste) and hard code the order to check them. This does work, but it sacrifices the shared priority system, so I'd rather not use this solution unless there's really nothing better.
  • Instead of using "Destination full", have the dropoff interrupts check if the station is available. This (theoretically) works to check all three at the moment the train leaves the station, but if none are immediately available we're back to the exact same problem.
  • Have the train ensure one of the stations is available before logically leaving the pickup station. This isn't possible because the pickup interrupt doesn't know the station's contents, and thus doesn't know the dropoff stations' names. (Unless I use signal dispatching for pickups, but that doesn't respect priority at all, so is a worse solution than splitting pickup station names.)
  • A mod that makes stations send circuit signals to trains "at", but not "in", the station. This would be great, but I don't know if such a mod exists or even is possible.
I know this is a hard problem, but if anyone has a better solution, I'd really appreciate it. :D

Re: Trains—Backup interrupts only when leaving station with signal

Posted: Sun May 17, 2026 5:20 pm
by Nidan
How do your schedules and interrupts look like? From what I can tell, as long as the train hasn't moved and is still picking its destination (zzz icon), the stations signals are still available. There are two things you'd have to watch out for to keep the train in that state if no valid destination is available.

I'd prefer one of your discarded solutions however:
foxoftheasterisk wrote: Sun May 17, 2026 1:53 pm Instead of using "Destination full", have the dropoff interrupts check if the station is available. This (theoretically) works to check all three at the moment the train leaves the station, but if none are immediately available we're back to the exact same problem.
It, again, has two things to watch out for, but in my test setup I found the "buf if" part to not apply; trains were waiting properly until one of the target stations became available.

Re: Trains—Backup interrupts only when leaving station with signal

Posted: Sun May 17, 2026 6:32 pm
by foxoftheasterisk
Nidan wrote: Sun May 17, 2026 5:20 pm How do your schedules and interrupts look like? From what I can tell, as long as the train hasn't moved and is still picking its destination (zzz icon), the stations signals are still available.
Wait, really? Oh, that does open up some options, then.

I think I see what you're getting at. I'll try it out and see if it works, and report back. (Along with a little spading test for my own curiosity.)

Re: Trains—Backup interrupts only when leaving station with signal

Posted: Sun May 17, 2026 8:25 pm
by foxoftheasterisk
Alright, I got it working! In a very silly way, but nonetheless, working. Details for those curious.

It turns out that, as you said, the signals are still sent to the train while it's waiting for space. So my setup would have worked fine—except that, if the train is waiting not because of "Destination full", but because of "No path", it loses the signals. So, because the resource that needed to be recycled had no Demand station, the train got stuck.

So it doesn't work to send trains to the Demand station, then interrupt it with the other two. But we also can't have it check the Demand station before entering that interrupt, because then the train will fall through to a state with no schedule and get stuck. (Or fall through to its default schedule and leave the pickup station, which is also bad.)

Enter the load bearing coconut.
20260517124858_1.jpg
20260517124858_1.jpg (460.01 KiB) Viewed 226 times
"Coconut" is simply a train stop that is always present and always disabled. This means we can set up a "Load Bearing Coconut" interrupt that goes to this stop when the train is ready to drop off cargo...
20260517125831_1.jpg
20260517125831_1.jpg (396.31 KiB) Viewed 226 times
...which is then interrupted in turn by the three dropoff stations, in order.

It works perfectly, and also removes the annoying "No path" errors that come up from building a pickup station before its dropoff! So I'm very happy. :D

Re: Trains—Backup interrupts only when leaving station with signal

Posted: Mon May 18, 2026 3:11 pm
by Amarula
Delightful! Excuse me while I go add a Load Bearing Coconut to my train system :D