Filter inserters should allow using the items signal count as stack size

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Filter inserters should allow using the items signal count as stack size

Post by mrvn »

TL;DR
Inserters should be able to use a stacksize set by the signal of the item they pick up.
What ?
When setting the stack size of an inserter by circuit wire there should be the option to pick the "each" symbol. This should then mean an inserter picking up coal will use the coal signal. An inserter picking up iron plates will use the iron plates signal.
Why ?
When building a train station that handles mixed goods it becomes important not to overfill the cargo wagons. Otherwise there will be too much of item A in the wagon and not enough space left to add item B and the train will never leave.

In vanilla the train station has no way to read out what the train wants. But you would design the station to fill a train half with iron and half with copper for example. So you know how much of each the train should hold and the train stop tells you how much is already loaded. The usual way is then to compute the amount of missing items and to use (stack) filter inserter with "set filter" to load what's missing. Problems arrise then the train arrives with some items remaining. (Note: With LTN you can read out what the train wants and make it totally dynamic, making this problem far more common.)

The problem there is that if 1 iron ore is missing the stack filter inserter will still load 12 iron ore. This leads to overfilling and dead locked trains. Another problem is that it frequently leaves inserters with items left in the hand hovering over the rail. Then when the next train arrives the items are dropped into the cargo wagon. Potentially items the train doesn't want at all.

The circuit logic to make the inserters only load count perfect items for a multi cargo is rather complex and large and has to fight with getting the timing right and never leaving items in the hand of inserters. The alternative is to try to load roughly the right amount and have an extra filter inserter to take out any excess. This runs into the problem that there might not be any space in the buffer chest to put excess items back. So more circuit logic to make sure space remains to take out items from the train.


To make a long story short: There is no way to select just one signal from a wire and to use that to set both the filter and the stack size for an inserter. And one must "select" a single signal because one has to send the signal itself for the filter and also an "S" signal to set the stack size. If one could configure the (stack) filter inserter to use the signal of the items it picks up to set the stack size then this would make loading trains to exact counts much more simple. Sending 7 iron ore and 5 copper ore would then make the stack filter inserter pick up at most either 7 iron ore or 5 copper ore.

Note: This would also allow loading assemblers or furnace in the ratios of their ingredients making programmable assembler or furnaces easier.
Illiander42
Filter Inserter
Filter Inserter
Posts: 521
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by Illiander42 »

The new "random other" combinator might let us do this.

I think it gives us a "output the highest value signal only" option?
vitharr
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Mar 08, 2024 3:41 am
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by vitharr »

Had this idea myself creating a station, and completely agree!
Trific
Fast Inserter
Fast Inserter
Posts: 155
Joined: Thu Dec 31, 2020 7:57 pm
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by Trific »

I agree that this should be a thing, but I disagree that the circuit logic is either complex or large (unless you consider 3 combinators large), nor does it require getting any timing right. You can use "anything, anything" on a decider combinator to pull out one signal from the "this is what the train needs loaded" line, and then use two deciders, one to delay the item signal by one tick (this would only be necessary if your inserters were incredibly fast) and the other to cast the number to a hand size signal.
Koub
Global Moderator
Global Moderator
Posts: 7784
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by Koub »

mrvn wrote: Sun Mar 10, 2024 12:08 pm
TL;DR
Inserters should be able to use a stacksize set by the signal of the item they pick up.
@OP : I'll link a couple threads hereunder. Can you confirm if they're all globally the same suggestion (or close enough) OR trying to address the same issue (or close enough) ?
If they do, I'll merge them all together, it's easier to follow a specific need from the playerbase if it's all in the same thread.
They seem pretty much the same suggestion to me, but maybe my understanding is insufficient, and there are real differences I have missed.

viewtopic.php?f=6&t=109660
viewtopic.php?f=6&t=96265
viewtopic.php?f=6&t=62189
Koub - Please consider English is not my native language.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by mrvn »

Trific wrote: Sun Mar 10, 2024 10:58 pm I agree that this should be a thing, but I disagree that the circuit logic is either complex or large (unless you consider 3 combinators large), nor does it require getting any timing right. You can use "anything, anything" on a decider combinator to pull out one signal from the "this is what the train needs loaded" line, and then use two deciders, one to delay the item signal by one tick (this would only be necessary if your inserters were incredibly fast) and the other to cast the number to a hand size signal.
That doesn't limit the number of items you load or remove excess, doesn't handle balancing items between cargo wagons, doesn't handle the requested number of items not being divisible by the number of wagons, doesn't handle loading items with many inserters when you need many items but just one for the last few, ...

Good tip about the "anything, anything" on a decider combinator. Since when does that select a single signal?

Dealing with one signal at a time make loading a lot simpler, although less efficient overall.

So I guess this feature request saves 3 combinators per inserter (that needs it): "anything > 0, anything" ==> "mod 12" => "each + 0 = S". You still need some more combinators for the full station. So not just 3.
Trific
Fast Inserter
Fast Inserter
Posts: 155
Joined: Thu Dec 31, 2020 7:57 pm
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by Trific »

mrvn wrote: Tue Mar 12, 2024 4:15 pm That doesn't limit the number of items you load or remove excess, doesn't handle balancing items between cargo wagons, doesn't handle the requested number of items not being divisible by the number of wagons, doesn't handle loading items with many inserters when you need many items but just one for the last few, ...
It does exactly the same thing as having the filter stack inserter take its hand size from the item signal. Anything you can do with your proposed change you can do with this. I'm unsure how setting the hand size from the item signal would do all that you listed. Edit: Actually, I just realized that what you also want is a filter inserter that filters its signals by what it is holding in its hand (and not filtering until that point). That is a whole 'nother ball of wax, and would require extensive changes to filter inserters. What exactly should one do if it picks coal out of its chest and there is no coal signal? How does it know it needs the coal signal until it has picked up the coal? How many does it know to pick up if it holds nothing?
Good tip about the "anything, anything" on a decider combinator. Since when does that select a single signal?
Since version 1.1.13
Dealing with one signal at a time make loading a lot simpler, although less efficient overall.

So I guess this feature request saves 3 combinators per inserter (that needs it): "anything > 0, anything" ==> "mod 12" => "each + 0 = S". You still need some more combinators for the full station. So not just 3.
If you wire up a bank of inserters with your proposed change to a wire carrying what the train wants (having subtracted what is already on the train, presumably), they are all going to choose the same item, because it is deterministic. If the train wants 5 of a particular item, and that is the top of the draw, they will all grab 5 of the item, and load it. They don't communicate with each other about what they are grabbing.

I am unsure what the "mod 12" thing is for. If you give it a stack size larger than it can handle (max 12 for a standard stack inserter), it will set the hand size to 12. You don't need to cast it down. As long as you are taking the signal from the stop with what is already on the train and subtracting that from "what the train wants", then on the last "less than 12" load it will set the hand size down to load exactly what was requested.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by mrvn »

Trific wrote: Wed Mar 13, 2024 2:34 am
mrvn wrote: Tue Mar 12, 2024 4:15 pm That doesn't limit the number of items you load or remove excess, doesn't handle balancing items between cargo wagons, doesn't handle the requested number of items not being divisible by the number of wagons, doesn't handle loading items with many inserters when you need many items but just one for the last few, ...
It does exactly the same thing as having the filter stack inserter take its hand size from the item signal. Anything you can do with your proposed change you can do with this. I'm unsure how setting the hand size from the item signal would do all that you listed. Edit: Actually, I just realized that what you also want is a filter inserter that filters its signals by what it is holding in its hand (and not filtering until that point). That is a whole 'nother ball of wax, and would require extensive changes to filter inserters. What exactly should one do if it picks coal out of its chest and there is no coal signal? How does it know it needs the coal signal until it has picked up the coal? How many does it know to pick up if it holds nothing?
NO, that's not what I want. The filters will be set by wire. The requested feature is just to have the filter inserter set it's stack size to the signal count of the item it's picking up.

Actually make that any inserter. No reason a stack inserter shouldn't also set it's stack size according to what it picks up.

All the above things needed for a proper multi-item multi-wagon train station was regarding only needing 3 combinators. The balancing and optimizing the number of inserters that do work at the same time takes most of the inserters.

And yes, one can do it with the "anything > 0: anything" decider combinator. Not as easily and only by limiting (some) inserters to one item at a time. With the above feature one could just set a signal of "5 iron plate, 3 copper plate, 1 stone brick" and let the filter inserter pick up those amounts of whatever items are available.

With a train station there often are multiple chests with different items. The deciver combinator might pick the iron plate signal and there might not be any iron plates in the chest for the inserter on one chest. The above feature would allow the filter inserter to load the copper plates or stone bricks instead.
Trific wrote: Wed Mar 13, 2024 2:34 am
Good tip about the "anything, anything" on a decider combinator. Since when does that select a single signal?
Since version 1.1.13
Dealing with one signal at a time make loading a lot simpler, although less efficient overall.

So I guess this feature request saves 3 combinators per inserter (that needs it): "anything > 0, anything" ==> "mod 12" => "each + 0 = S". You still need some more combinators for the full station. So not just 3.
If you wire up a bank of inserters with your proposed change to a wire carrying what the train wants (having subtracted what is already on the train, presumably), they are all going to choose the same item, because it is deterministic. If the train wants 5 of a particular item, and that is the top of the draw, they will all grab 5 of the item, and load it. They don't communicate with each other about what they are grabbing.

I am unsure what the "mod 12" thing is for. If you give it a stack size larger than it can handle (max 12 for a standard stack inserter), it will set the hand size to 12. You don't need to cast it down. As long as you are taking the signal from the stop with what is already on the train and subtracting that from "what the train wants", then on the last "less than 12" load it will set the hand size down to load exactly what was requested.
In may latest design with a warehouse I set one inserter to a "mod 12" signal. The second inserter to each - 11, the thrid to each - 23, the fourth to each - 35 and so on. Only the first inserter with "mod 12" needs to set the stack size. So when you load 27 iron plates the first inserter gets a "3 iron plates" signal. The second inserters gets 15 iron plates and the thrid inserter gets 3 iron plates and each load 12. The fourth inserter gets no signal. That gives a total of 27 iron plates loaded all at once.

The "anything > 0: anything" makes this all work now. So the requested feature isn't so important anymore. But it would still be nice to have as it works better with individual chests at train stations instead of a warehouse mod.

Note: most annoyingly the "anything > 0: anything" decider combinator will pick the LTN stations locomotive and wagon count and location signals over actual items. So you have to mask out at least 4 signals from the requested items to actually get an item count selected.
Trific
Fast Inserter
Fast Inserter
Posts: 155
Joined: Thu Dec 31, 2020 7:57 pm
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by Trific »

mrvn wrote: Sat Mar 16, 2024 1:56 pm NO, that's not what I want. The filters will be set by wire. The requested feature is just to have the filter inserter set it's stack size to the signal count of the item it's picking up.
If you have the filters set by wire, and send the same set of signals to all the inserters, all of the stack filter inserters will all be set to filter the same item, because it is deterministic. If the item doesn't exist in its source, it will sit idle. The inserter doesn't control what item it is picking up, the signals do.

I just want you to understand that what you want is way more than just having the inserter take its hand size from the signal. It would require a complete revamp of how inserters work with signals. With respect to your design, only one inserter needs to have the hand size set, so it wouldn't save much in terms of combinators, in exchange for more complex inserter control (the UPS accountants will freak).
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Filter inserters should allow using the items signal count as stack size

Post by mrvn »

Trific wrote: Sat Mar 16, 2024 2:42 pm
mrvn wrote: Sat Mar 16, 2024 1:56 pm NO, that's not what I want. The filters will be set by wire. The requested feature is just to have the filter inserter set it's stack size to the signal count of the item it's picking up.
If you have the filters set by wire, and send the same set of signals to all the inserters, all of the stack filter inserters will all be set to filter the same item, because it is deterministic. If the item doesn't exist in its source, it will sit idle. The inserter doesn't control what item it is picking up, the signals do.

I just want you to understand that what you want is way more than just having the inserter take its hand size from the signal. It would require a complete revamp of how inserters work with signals. With respect to your design, only one inserter needs to have the hand size set, so it wouldn't save much in terms of combinators, in exchange for more complex inserter control (the UPS accountants will freak).
I understand this and that is not what I'm doing when using a warehouse. There every inserter gets a different signal in the train station. Actually only one gets a "set stacksize".

When using chests with different item types per chest though you would send the same signal to all inserters but each can only pick up what is in the chest. That's actually the case where the requested feature is most useful. Each inserter will pick whatever is in the chest in the amount given by the wire. Each inserter will pick something different because that's all that is in the chest.

Currently this requires matching the required items with the the item in each chest (which is a red * green operation), then picking out a single signal from the result (if more than one item can be in a chest) and finally changing the choosen signal to S to set the stacksize as well as the filter. That's 11 combinators per chest. With the above feature it would be 0 per chest.
Post Reply

Return to “Ideas and Suggestions”