Page 1 of 1

Allow interrupts with wildcards to wait for X amount of cargo

Posted: Fri Oct 25, 2024 2:04 am
by mrvn
TL;DR
One can use wildcards to set the target station for an interrupt but not wait for X amount of the selected cargo.

What ?
I have a Research station with a train set to fetch science packs as needed using interrupts like this:
interrupt.png
interrupt.png (420.76 KiB) Viewed 499 times
The station is set to "Send to train" and sends a signal for any science pack it is lacking. The train then checks if any station named after the science pack has a train limit > 0 and goes there. Here shown for blue science.

The problem is that the only wildcard for the "Item Count" condition is "Item Parameter", which is replaced when the interrupt fires. At that point the cargo wagon is empty so the condition becomes empty.

One should be able to use "Everything", "Anything" or "Each" in the condition. Even "Signal Parameter" would work, provided the signal is an item.
Why ?
Using parameters in interrupts is amazing because the same interrupt then works for every station regardless of what item to transport. This works great for ore or plates with the "Cargo full" condition as transporting less than a full train would be wasteful there.

But more advanced products are too expensive and slow to produce to work in units of full trains. So it would be great if one could have the train handle smaller item counts.

PS: I've worked out 2 workarounds so this might be a "won't fix" issue:

1)
One can add a arithmetic combinator to the loading station with "eacho + 0 = each" and set the station to "Send to Train" and "Read Train Content". This turns the trains content into a signal and the "Circuit Condition" condition can use the "Signal Parameter" in the interrupt.
interrupt2.png
interrupt2.png (631.44 KiB) Viewed 499 times
The arithmetic combinator trick requires the use of a wire color nobody else is using to read the train content. Otherwise it duplicates signals send to the train stop. Also adds 1 tick delay for the condition.

2) Limit the cargo wagon:
interrupt3.png
interrupt3.png (61.93 KiB) Viewed 499 times
With the cargo wagon limited one can use "Cargo Full" again. But then all transfers for this train will use the same limit. One can't fetch 5 stacks of steel and 40 stacks of iron plates for example when the consumption of items isn't uniform. Or the same amount (e.g. 100 items) when the stack size of the items differs.

PPS: Another solution could be to leave the "Item Count" wildcard in the schedule until such a time that an item actually exists that matches the condition. But that would be basically "Anything".

Re: Allow interrupts with wildcards to wait for X amount of cargo

Posted: Fri Nov 15, 2024 11:33 am
by ZzZombo
A thousand times this! You can use it everywhere else but in the "Item count" condition.