[2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Bugs that are actually features.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 386
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

[2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Hares »

Context: I am designing clocking-safe rail system for delivering fruits on Gleba with minimized raw fruit spoilage. This is the crane cell design I came up with:
11-14-2024, 16-43-55.png
11-14-2024, 16-43-55.png (599.48 KiB) Viewed 666 times
The settings on the stack inserter are:
  • Hand size: 10
  • Circuit network: Set filters
  • Filtering mode: Whitelist
  • Spoilage priority: Not set
Circuit network provides either fruit+spoilage signals, or nothing. The signal is sent when specific conditions are met, most notably -- the number of fruit items on belts. To prevent inserters having items in their hand, I set the hand size to be a factor of fruit stack size -- 10, which means, that if the crane started with full stacks of fruits (which it does), stack inserters will be always able to grab a full hand of things.

However, I noticed that sometimes stack inserters are left with items in hand in quantities other than 10. Furthermore, the sum of number of items in hand AND number of items in the crane is also not divisible by 10 -- in the video attached it's 4 in one hand, 0 in other hand, and 0 in crane. Which means that either fruits disappear (which they don't), or cranes created a non-full stack of items (which isn't possible at least because these cranes are deployed outside of plantation field), or inserter made a non-full-hand item pickup.
Click here to expand the video
Blueprint:


Note that for this setup to replicate the behavior, 3 of 4 cranes (all but top-left) were loaded with 2 full stacks of jellynut. Reproduced multiple times, with these exact numbers reproduced 100% of attempts.
Attachments
2024-11-14 16-36-37.mp4
(12.53 MiB) Downloaded 21 times
robot256
Filter Inserter
Filter Inserter
Posts: 936
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by robot256 »

Another potentially related report of a stack inserter getting stuck when items are available: 118138
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 386
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: [2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Hares »

robot256 wrote: ↑Thu Nov 14, 2024 2:18 pm Another potentially related report of a stack inserter getting stuck when items are available: 118138
I checked that topic before posting this and it's not related.
robot256
Filter Inserter
Filter Inserter
Posts: 936
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by robot256 »

I know it's not a duplicate, but when they mess with the code to fix one they will probably find what is causing the other as well.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 386
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: [2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Hares »

FactorioBot wrote: ↑Tue Nov 26, 2024 4:53 pm Bugfixes:
  • Fixed stack inserter would start dropping partial held stack when waking up by control behavior. (122439)
Similar issue reported in 2.0.20 & fixed in 2.0.22.
The issue mentioned in this topic, however, reproduces on a newer version. Same steps-to-reproduce.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3058
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by boskid »

The only suspicious thing that i may need to investigate is that i see inserter not dumping hand content onto belt when filters are cleared but the bug report seems to be focusing on something different: specifically on the hand size override and full hands. Stack inserters when dropping onto a belt were specifically made to grab less to match belt stack size, which is achieved by a prototype flag set on inserters, a InserterPrototype::grab_less_to_match_belt_stack (i tried to come up with a self explanatory name here). That means that even if you have those stack inserters set with stack size override of 10, it only grabs up to 8 items since that is a largest multiple of belt stack size that can be dropped without leaving a partial stacks on the belt.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3058
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by boskid »

Ok, for 2.0.23 i did one change: when filters are set causing held item to become incompatible, inserter will enter drop mode to get rid of the held items. This was the only bug i was able to identify in this bug report. Hand size override behavior seen here i am considering to be correct.
Valeskas
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Sep 16, 2016 4:59 pm
Contact:

Re: [2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Valeskas »

boskid wrote: ↑Thu Nov 28, 2024 9:11 am That means that even if you have those stack inserters set with stack size override of 10, it only grabs up to 8 items since that is a largest multiple of belt stack size that can be dropped without leaving a partial stacks on the belt.
If its not a technical limitation, then its really weird.
Player can easily enter a multiple of belt stack if so desired.
The only scenario where I used stack size override, is to move biter eggs from platform hub, to make batch size divisible by stack size.
And it may unexpectedly spawn biters, as this behavior not at all communicated by the game, might leave some eggs in the stack inserter hand.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 386
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Hares »

boskid wrote: ↑Thu Nov 28, 2024 10:51 am Ok, for 2.0.23 i did one change: when filters are set causing held item to become incompatible, inserter will enter drop mode to get rid of the held items. This was the only bug i was able to identify in this bug report. Hand size override behavior seen here i am considering to be correct.
If stack inserter has a filter for a spoiling item, and picks up incomplete stack, and that item spoils while within the hand -- does that mean the inserter will enter drop mode as the spoilage does not pass its filters, or is that event triggering only on circuit network/configuration update?
Last edited by Hares on Thu Nov 28, 2024 12:22 pm, edited 1 time in total.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3058
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by boskid »

If you set stack size override to 10, items that cannot stack that high are still getting transferred at a lower stack size, would you also consider that a bug because inserter does not obey its stack size setting? My understanding of the inserter's stack size override was that it is to ignore bonuses above certain amount so it behaves as an inserter with smaller stack size bonus, in which case a stack inserter with lower stack size would behave exactly the same way: it would grab less to match belt stack.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 386
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Hares »

boskid wrote: ↑Thu Nov 28, 2024 12:22 pm If you set stack size override to 10, items that cannot stack that high are still getting transferred at a lower stack size, would you also consider that a bug because inserter does not obey its stack size setting? My understanding of the inserter's stack size override was that it is to ignore bonuses above certain amount so it behaves as an inserter with smaller stack size bonus, in which case a stack inserter with lower stack size would behave exactly the same way: it would grab less to match belt stack.
If I intentionally set the hand size override to 10, I assume SI dropping items in batches of 4,4,2; not 4,4,4 because that's the exact amount I want it to grab. Also, does that feature/behaviour/limitation occur only when dropping onto a belt, or when dropping into a chest/container/machine too? If the latter is correct, then that's double weird.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3058
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by boskid »

Hares wrote: ↑Thu Nov 28, 2024 12:21 pm If stack inserter has a filter for a spoiling item, and picks up incomplete stack, and that item spoils while within the hand -- does that mean the inserter will enter drop mode as the spoilage does not pass its filters, or is that event triggering only on circuit network/configuration update?
Item spoiling in stack inserter's hand will make inserter to drop whatever it has without waiting for more (this behavior is enabled by InserterPrototype::enter_drop_mode_if_held_stack_spoiled. If you manually insert incompatible item into inserter's hand and it does not match current filters it will unconditionally try to get rid of it as inserter has nothing to do with it, would not be able to grab more of it due to filters. Bug that was fixed for 2.0.23 was that this logic was not guarding filter changes: before it was only triggering when incompatible item was detected due to held stack changes, with the fix it will also be detected due to filter changes.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3058
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by boskid »

Hares wrote: ↑Thu Nov 28, 2024 12:25 pm If I intentionally set the hand size override to 10, I assume SI dropping items in batches of 4,4,2; not 4,4,4 because that's the exact amount I want it to grab.
I see, in that case i am moving this topic out of Resolved for the next release (+removing link from the changelog to avoid confusion) and moving it to Not a bug because this is what this topic is about and right now it is working exactly as it was designed to work. Stack size override was never meant to force inserter to grab exactly that much or do nothing, it can grab less if item does not stack to that amount. There are also corner cases where you have an inserter from a blueprint and stack size override is above the currently researched stack size bonus in which case inserter will use the lower value of the two in which case using a proposed logic inserter would be forced to drop partial stacks until proper stack size is unlocked just because inserter is told to obey the stack size while not being able to reach it. If you do not agree with current behavior then i suggest opening a suggestion topic where this can be discussed in a slightly more open atmosfere that does not suggest this behavior as being a bug.
Valeskas
Burner Inserter
Burner Inserter
Posts: 14
Joined: Fri Sep 16, 2016 4:59 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Valeskas »

boskid wrote: ↑Thu Nov 28, 2024 12:22 pm If you set stack size override to 10, items that cannot stack that high are still getting transferred at a lower stack size, would you also consider that a bug because inserter does not obey its stack size setting?
No, it is something of a common sense, that if unstackable items like promethium chunks are too big to be stacked, then they are too big for stack inserter.
A bit obscure, but not weird.

What reason is there for stack inserter to not obey the engineer in case of conveyor belt stacks?
I cant think of in-universe reason and/or game balancing reason.

It was not obvious to me that it was designed that way, thanks for clarifying.
User avatar
Hares
Filter Inserter
Filter Inserter
Posts: 386
Joined: Sat Oct 22, 2022 8:05 pm
Contact:

Re: [boskid][2.0.17] [SA] Stack inserter behaves wierdly with hand size overrides

Post by Hares »

Hares wrote: ↑Thu Nov 28, 2024 12:25 pm Also, does that feature/behaviour/limitation occur only when dropping onto a belt, or when dropping into a chest/container/machine too? If the latter is correct, then that's double weird.
I tested it, and when dropping items to chest, it uses the exact override value.
Post Reply

Return to β€œNot a bug”