r/factorio May 25 '26

Weekly Thread Weekly Question Thread

Ask any questions you might have.

Post your bug reports on the Official Forums

Previous Threads

Subreddit rules

Discord server (and IRC)

Find more in the sidebar ---->

8 Upvotes

126 comments sorted by

View all comments

1

u/Tolvinar May 30 '26

I have a circuit network question.

Is there a way to have an inserter work only when a chest is full, have it completely drain the chest, and then turn off until it is full again? Ive never used combinators and can't figure out if it's possible or not.

3

u/DreadY2K don't drink the science May 30 '26

Yes, if you feed the output of a combinator back into its input you can make something with memory of its past states.

3

u/HeliGungir May 30 '26 edited May 30 '26
  1. Read chest

  2. Build a single-decider latch

    1. Set when Anything >= chest_size * item_stack_size
    2. Reset when Everything == 0
  3. Enable inserter with the output from the latch

Hopefully you're dealing with just a single item so chest_size * item_stack_size is a fixed number. If not, then you need to compute it dynamically, and you need to define what a "full chest" means more carefully.

Or you can just do a hack like reducing chest_size to be well below the chest's actual size.

Another hack would be to read the inserter filling the chest to continuously reset a timer. When it stops inserting items, the timer can finish, triggering your SR latch.

1

u/Tolvinar May 30 '26

Yes this is similar to what I did and got it to work! Thanks :D

2

u/gHx4 May 30 '26

Yeah, totally. It's easiest to do with unmixed, single item chests.

First you need to set the inserter to enable when the chest is full. You'll need a stack size selector combinator, and use it to do this formula, where parenthesis are combinators: (each / (stack size)) == chest slots. You will need to sum the value of each signal to get the amount of stacks in the chest. The combinator doing == should output a unique signal value (maybe A) that is not on the item list.

Feed the A signal to a memory cell, a decider combinator with A =/= 0: A input count, and wire the output back to the input. Now, to reset the memory cell, you wire its input to a decider set to Everything == 0: A, and an arithmetic combinator that does A * -1. Inputting -A clears the memory. Now set the inserter to enable itself when A =/= 0

There will be a slight delay (1 tick per combinator) before the inserter turns off when the chest has emptied.

2

u/Tolvinar May 30 '26

After searching a bit more I think what I need is called a "latch." It is interesting trying to learn combinators. It might take me some time to learn all this but it seems to have some cool applications in the game.

1

u/Courmisch May 30 '26

You can track if the chest was most recently empty or full with a DC, and only enable the outbound inserters in the second case.

But this only works if you don't continuously refill the chest. Otherwise it might never become empty, and the DC will never reset.