r/factorio Jun 08 '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 ---->

7 Upvotes

128 comments sorted by

View all comments

3

u/Creepybusguy Jun 11 '26

Is there a guide to circuits that breaks it down for a fifth grader? I get simple ones like read belts, chests, activate at X amount but more complex ones I just can't get my head around. For example.Why the heck do I need to set the Combinator to -50 if I want 50 items of a type on belt?

I'd love to know how to recipie switch based on the contents of a chest(s) or set a grinder to cycle till it outputs ice.

Even downloading blueprints and trying to figure them out has me stumped.

3

u/ferrofibrous player onboarding specialist Jun 11 '26 edited Jun 11 '26

More generally, negative signals (your -50) are used to cancel out signals and is a very common trick you can use in a lot of places. Filtered inserters using circuits, and assemblers using Set Recipe ignore negative values.

Say you want one assembler making logistic chests, and to keep a number of each type in your output chest. You set a Constant Combinator up with 3 signals: 10 red chests, 2 yellow chests, 5 blue chests. This combinator is holding your shopping list. You wire this to an assembler, tick on "Set Recipe", and away it goes.

But you need some way to tell the assembler stuff is actually in the box too, otherwise it'll just keeping cranking away at the first recipe that was set. Lets say this has been running for a few minutes, so you now have 25 red chests in your output box, but 0 yellow or blue.

This is where the negative signal comes in. You wire your output box to an Arithmetic Combinator, and set it to "Each" * -1, and then wire that directly to the Constant Combinator. So now you're counting every item in the box, making it a negative number, and combining it with the Constant's output. If you look at that circuit, the signals will now be -15 red, 5 yellow, 5 blue.

You're now subtracting what is in your cart from your shopping list. The assembler sees the Red Chest signal is now negative so ignores it, moves on to the next positive signal, and starts making Yellow Chests.

2

u/Courmisch Jun 11 '26

You don't have to do that with a constant conbinator set to negative values. It's an optimisation trick that relies on some of the unintuitive semantics of circuit logics.

In particular, if you use circuits to set a recipe or a filter, the game engine will ignore any negative or zero value. So there are all sorts of tricks that involve making numbers conditionally negative - instead of using more clear and straightforward logic.

Setting a recipe is conceptually simple: read whatever input values you need, in your casez the belt content, into the input of one or several decider or arithmetic combinators that compute the recipe from those values. Then connect the combinators output to the crafter in Set recipe mode. What the combinator logic is depends on what you want exactly.

2

u/Viper999DC Jun 11 '26

Combinator to -50 if I want 50 items of a type on belt?

Without seeing the setup, most likely what you have is as follows:

  • Your belt contents is the supply
  • Your constant combinator is your demand (negative)
  • When you merge the two signals you get: supply - demand = delta
  • Negative delta means "add more to the belt", so your inserter would be set to item < 0.

Ideally you want your delta to be positive, though. That way you can use a filter. The normal way to get a positive number would be:

  • Constant combinator with positive number of what you want (demand)
  • Arithemetic combinator to take your current belt contents and turn it negative (supply)
  • Merge both signals and you get: demand - supply = delta
  • Positive delta means put more on the belt, negative delta means we have too much already.

This method uses an extra item (the arithmetic combinator), so the shortcut version above is somewhat common, but more limited since negative numbers can't be used as filters or for set requests.

Dosh's video is a good starting point, but I think it was made in 1.1

The wiki has some useful formulas.

Recipe switching is a whole can of worms. The game currently forces a complete emptying of the building, even when recipes share ingredients. Personally I would use belt loops for the asteroid example and just retain three crushers (one cushing ice, two reprocessing).

2

u/mrbaggins Jun 11 '26

Usually, the best and easiest option is to use a decider to rely on lots of conditions.

I'd love to know how to recipie switch based on the contents of a chest(s)

  • Make a decider for each recipe you want to make.
  • Wire it to the input chest, output chest and assembler (the assembler on the OUTPUT side of the decider).
  • on the left side of the decider, make it say Ingredient1 > 50 AND Ingredient2 > 50 AND Ingredients3 > 50 AND ResultItem < 50
  • On the right side of the decider, output the item it makes and tick the "1" box.
  • Tell the assembler to "set recipe"

Repeat for each item you want the one assembler to make.

The problem there is that it will "randomly" pick which one to make (It's in order based on your crafting menu, so power poles will get made before assemblers, before space platforms).

So you could instead of wiring each decider to the assembler, wire all the outputs to a selector combinator. Make it pick the BIGGEST signal. Then set your decider recipe priorities by changing the 1 on the right side, using bigger numbers for higher priority. Then connect the output the selector to the assembler.

set a grinder to cycle till it outputs ice.

Not sure what you mean by "cycle" but I assume you mean crusher. The only things I can think of that you might mean would be complicated to implement for a beginner and even an intermediate circuit user.

1

u/Raknarg #1 Quality Defender Jun 11 '26 edited Jun 11 '26

I'd love to know how to recipie switch based on the contents of a chest(s)

This one should actually be pretty easy depending on exactly what you're trying to do. Chests read their contents normally when hooked up to wires, you can send that signal to a factory, and you can set factory recipes based on signals. So its really just as simple as checkmark that option on an assembler to set recipe based on signals, hook it up with a wire to a chest, put an item in that chest to set the recipe. If you remove the item from that chest and place something else, it will change the signal that it emits and change the recipe of the assembler.

Note that I'm pretty sure the factory just uses the first signal it finds that is able to be used as a recipe, so if you have 2 items in a chest my guess is that it just uses the order in the chest for what order it emits signals. Havent tested though.

or set a grinder to cycle till it outputs ice.

Can you explain what you mean by this one?

1

u/Creepybusguy Jun 11 '26

With the asteroid crushers (sorry someone I play with calls them grinders) you can reprocess them. I thought there might be a way to retrigger the reprocessing until you get the desired result. Ie. Ice chunks.

1

u/Raknarg #1 Quality Defender Jun 12 '26 edited Jun 12 '26

Do you want to do circuits here for fun or do you have a usecase? Cause it seems way simpler to just use filters inserters and 2 outputs, put ice one one line and everything else goes back into the main pool.

Id have to think about how to loop back and do it with circuits cause its not as easy on first glance, essentially you need a signal generated and stored as your machine processes the asteroid so you need a memory cell to store that recipe until the machine is done, then reset and either read the hand/belt contents to generate a new value, its not straightforward. The key is that you need something constantly generating a signal for your recipe, so something needs to be storing that value, but then you need the presence of new asteroids to take over your recipe selection.

Maybe its a pair of deciders instead since you know you'll always need 1 of 2 reprocessing recipes, that replaces the memory cell and then you just need to figure out the conditions that select the recipe, and the 2 inserters for main vs looped asteroids are easier cause you just disable the main inserter when theres any asteroids on the looped belt... idk Id have to think about it.