Inserters pulling from a box

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
PFQNiet
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Inserters pulling from a box

Post by PFQNiet »

If I have a box being loaded by one inserter, and pulled from by three inserters, most of the time it cycles through the three inserters, each one taking its turn at pulling an item from the box.

However sometimes, for reasons I can't discern, one or two of the inserters won't pull any items, and their outputs will remain barren until the other(s) are completely backed up - which in some cases may never happen.

Usually, removing and re-building the structure fixes the issue, but sometimes it remains broken even after re-building. This is also happening with the modded entity I'm creating (which uses the inserter-box-inserters structure mentioned above, and is the actual reason I can't just "use a normal belt balancer").

Is this something I can fix myself, or - since I'm making a mod - can detect/fix in code?

Yoyobuae
Filter Inserter
Filter Inserter
Posts: 421
Joined: Fri Nov 04, 2016 11:04 pm
Contact:

Re: Inserters pulling from a box

Post by Yoyobuae »

PFQNiet wrote:
Thu Oct 15, 2020 1:05 pm
If I have a box being loaded by one inserter, and pulled from by three inserters, most of the time it cycles through the three inserters, each one taking its turn at pulling an item from the box.
You should never rely on this behavior.

It was never intended to use a box and inserters as a makeshift splitter. Splitters are the ones which are designed to give the behavior you want. The fact that inserters picking up from boxes can sometimes work as a splitter is just mere coincidence.
PFQNiet wrote:
Thu Oct 15, 2020 1:05 pm
Is this something I can fix myself, or - since I'm making a mod - can detect/fix in code?
The game processes entities in an order based on their location on the tile grid. The player spawn at location {0,0}, from there the grid is divided into chunks of size 32 by 32 tiles. If you press F4 key in-game and select "show-tile-grid" you'll be able to see tile boundaries.

When your inserter/box contraption lies across one of those tile boundaries then it breaks. Inserters on one side of the boundary will always be processed first and thus will always have priority at picking the single item.

The way to fix it is to always ensure the inserters and the box entity lie on the same chunk. Ideally you would place the inserter and box entities in the exact same tile.

Another alternative would be to use circuit network to disable the inserters until there's enough items in the box for all of them to pick up.

PFQNiet
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: Inserters pulling from a box

Post by PFQNiet »

Ahh, thank you for pointing out the chunk thing. Of course in hindsight it's blindingly obvious. Since the modded entity I'm making has invisible "super-inserters" shuffling the items around, I can certainly put their bases on the tile that the box is located on. Thanks a lot!

EDIT: Updated mod code to put the inserter bases on top of the box rather than at the output position, ran `/c game.reload_mods()`, mined and re-placed my entity and ta-da it all works. Thank you again!

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: Google [Bot]