[2.0.23] Buffer and requestor chest's 'Trash unrequested' may sometimes stack items incorrectly

Bugs that are actually features.
Anthouse
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Dec 04, 2024 10:35 am
Contact:

[2.0.23] Buffer and requestor chest's 'Trash unrequested' may sometimes stack items incorrectly

Post by Anthouse »

Goal:
I was trying to make a buffer/requestor chest filled with 48 requests of full stacks of distinct items. I enabled 'Trash unrequested' on the chest, as I need each slot to be a different item, and not overfilled contents of other items. E.g. 100 yellow belts, 100 red belts, 100 blue belts, ...45 other full item stacks.

However, if the contents of the chest are modified while a bot is in transit, the bots will overfill the chest, the chests trashes items, and ultimately the item stacks may become split into 2 item slots, causing the chest requests to not be satisfied and logistic bots to get in a weird loop.

I have attached a demonstration save file and a video of the weird behavior. All you have to do is resume time from the /editor and you will see the odd behavior.
trash unrequested.mp4
(13.05 MiB) Downloaded 12 times
.

Setup:
There is a chest that has 97 yellow belts (with a request of 100), an empty item slot (with a request of 50 lamps), and 46 full stacks of different items (which were requested). I have set it up so that after a logistic bot is on the way to the chest with yellow belts, the chest receives 2 yellow belts from an inserter (i.e. an "outside force").
The ideal goal of the bots is to add the 3 yellow belts AND 50 lamps to the chest, perfectly fulfilling the chest's requests.

Timeline:
- Time is resumed from the /editor
- Left logistic bot is deployed to pick up multiple yellow belts.
- Right logistic bot is deployed to pick up lamps.
- Left logistic bot picks up the yellow belts.
- An inserter places 2 yellow belts into the target chest, changing from 97 to now 99 yellow belts in its stack.
- Left logistic bot inserts 3yellow belts into the target chest, causing it to fill the stack from 99 to 100, and creates a new stack in the first slot with the additional 2 belts, while auto-trashing the extra from the last slot. The chest now has a stack of 2 yellow belts and a stack of 98 yellow belts, and 2 in the trash slot.
- Left logistic bot takes away the 2 trash belts.
- Right logistic bot arrives with lamps, but there is no storage left in the chest, as the yellow belts are occupying 2 item slots.
- Both logistic bots try to fulfill the queued request for lamps by grabbing more, but fail each time, and drop it off into another logistic chest.

Expectations:
I would have expected that the requester/buffer chest would perfectly stack the items so that all requests can be met. This issue means that instead of being able to perfectly request 48 full stacks of distinct items, dodgey timing reduces it to only 24 stacks of distinct items (as the stacks may be arbitrarily split). I also would have expected the logistic drones to stop attempting to fill lamps when it clearly did not have enough slots.

Possible fixes:
- When a logistic bot attempts to insert into a chest when all item slots are already taken, try to merge item stacks to free up item slots.
- Change auto-trashing to try to delete any partial stacks first if it can delete the full stack, rather than always taking from the last slot of the same item type. (e.g. in the example of one stack of 2 and one stack of 100, prefer to delete the stack of 2 first).
- Add an "auto-sort" checkbox for logistic chests that behaves similar to player's inventory item auto-sorting; this would merge all stacks to the minimum slots necessary (this does not seem very pragmatic and could be UPS expensive).
Attachments
factorio-current.log
(8.21 KiB) Downloaded 6 times
Trash unrequested stacking bug.zip
Save file that can deterministically reproduce the issue
(2 MiB) Downloaded 8 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 14475
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.23] Buffer and requestor chest's 'Trash unrequested' may sometimes stack items incorrectly

Post by Rseding91 »

Thanks for the report however this is not a bug.
If you want to get ahold of me I'm almost always on Discord.
Anthouse
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Dec 04, 2024 10:35 am
Contact:

Re: [2.0.23] Buffer and requestor chest's 'Trash unrequested' may sometimes stack items incorrectly

Post by Anthouse »

Hm, that is a bit surprising. Is there no simple way to enforce a perfectly filled buffer/requestor chest with 48 distinct item types then?
Rseding91
Factorio Staff
Factorio Staff
Posts: 14475
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.23] Buffer and requestor chest's 'Trash unrequested' may sometimes stack items incorrectly

Post by Rseding91 »

There is not.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”