Train Interrupt Condition for "Trains with this stop"
Posted: Wed Oct 23, 2024 4:53 am
TLDR
It would be cool if an interrupt condition could be used to control the number of trains with a route on a particular station. This would allow trains to reserve a route for themselves, keeping the number of trains responding to an interrupt to a reasonable amount.Motivation
I've been diving deep into the new train interrupt system which has been getting the gears in my mind turning. What I'm trying to build is a group of trains that can address any needs in my factory without any being specifically allocated to a particular route. What I have is ~15 (for now) trains in the same group with a schedule that is only go to Depot and wait 30 seconds. Then, for my factories, each consumer station can emit a signal to a circuit network for the type of item it is requesting if it is low. I have interrupts on those signals, which will task a waiting train to get a resource from a producer and supply it to the requesting consumer.The problem: If there are 15 bored trains waiting in the Depot, and a consumer of Iron Plates sends a signal, then 15 trains will go to the Iron Plate supply and load up, then wait because the consumer has a train limit of 1 and one of the other bunch has gotten there first. This blocks the producer from serving other trains. I also don't need all 15 to go help, just 1 will do.
What I've tried: I have set the train limit on the station to 1, but this causes other trains to wait in the prior station which blocks it. I can set the Depot as an intermediate stop between pickup and dropoff, but this means all routes will include a usually unnecessary pass through the depot, and if any wait there then they're tied up with resources they can't unload. I set the condition on the interrupt to not fire if there is a train at the consumer station, but when the signal is first sent that's not the case and all 15 can acquire the route.
What would be nice: If a condition for interrupts could be added to have a statement of "Trains with this stop" is > X given a stop. This allows me to control how many trains can claim a route, and would let me to service my factory with a very small number of trains using smart circuit signals. I think this seamlessly flows with the current interrupt logic, because once the request has been fulfilled the train no longer has the stop and the count of "Trains with this stop" goes down by 1 and if there is still a consumer need then either that train or another can start the interrupt over.