[2.0.23] Buffer and requestor chest's 'Trash unrequested' may sometimes stack items incorrectly
Posted: Wed Dec 04, 2024 11:50 am
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. .
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).
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. .
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).