TL;DR
It would be nice to have the train stops allowing to set the maximal value for the train limit got from the circuit network.What?
The train stop circuit setting "Set train limit" should have an additional optional integer field called smth like "but not more than..." which defines hard limit for the number of trains this station can support, even though the circuit network suggests the higher number.Why?
Usually, the train stops have the so-called waiting area which allows more than one train to wait in the queue until the station is free. However, the number of waiting spots is usually limited to 2 or 3, especially for the train stop stacks. If the numbers of trains approaching is higher then the number of waiting spots, a potential disaster can happen in a form of train blocking path to other stops nearby or even by stopping the main train bus. Thus, setting a limit not exceeding the number of wainting spots is a must.On the other side, if you have multiple train stops with the same name which is a normal practice, you want only stations with enough items in the inventory to be active or otherwise trains will always go to the closest one and wait 5 minutes until this almost-deplted mine can provide enough resources while the more distant ones have already stopped producing due to a full chests. Furthermore, just toggling enabled/disabled is not a solution either because that way the moment stop inventory exceeds the threshold 2-3-4 trains will start approaching while only one will be able to be fulfilled. Even more, the train stop will become inactive potentially locking trains on the middle of the rail network. Okay, let's just use arithmetic comb to divide the station inventory by a train inventory, and get the number of trains this station can handle... and oops, our full 12-chest-per-wagon station now requests astounishing 14 trains while only 3 staging slots (including the station itself!) are present!
Thus, the solution is born -- the combinators!
What we want is the following:
- Divide the station inventory by a number of items which could fit per one train
- Assume the result as the potential number of trains the train stop can handle (L)
- If the result (L) is greater than the number of waiting spots (M), use the last instead
- Option A: use multiple decider combinators to compare L & M and return the lowest of them, then cast the result to L. Pros: Works in any setup. Cons: Quite complex & uses a lot of combs
- Option B: use a series of decider combinators each comparing the station inventory (I prefer to do so in stacks, but it can be in any format) to a multiples of train capacity, and each returning L=1 if the comparison is passed. I.e., "if S >= 40 then L += 1; if S >= 80 then L += 1; if S >= 120 then L += 1" etc. Pros: Requires minimal number of combs, easy to setup. Cons: Number of combs and manual inputs greatly increases with the number of waiting spots
Allow train stops to use the max-limit "from the box".