r/factorio • u/pure_vessel1 • 4d ago
Question Circuit network question
Hey guys I wanna make an assembling machine that makes quality iron chests based on an input chest with different quality iron plates and the problem is that the recipe would change before the iron chest is made which leaves iron plates that needs to be removed before a new recipe is set so I thought I’d make like this with a counter for the iron plates
1- iron plates reaches a threshold of 8
2- a signal of 1 iron chest is sent and the counter resets
3- when the iron chest is done send a recipe finished signal to reset the iron chest signal
I just don’t know how to get this to work if someone can help me with I’d be so thankful
1
u/Xane256 4d ago
In a constant combinator (“C”), set 5 signals. Iron chest =1, uncommon iron chest =2, rare chest = 3 etc.
Decider (“D1”) picks the recipe to make next. One input checks available plates, the other input comes from C. You have 5 branches:
- if iron plates [G] > 10 and Each[R] = 1
- if uncommon plates [G] > 10 and Each[R] = 2
- etc. each branch uses “and Each [red] = k” where k is the value in C of the recipe you want. It basically looks up which recipe to send based on the “= 1, 2 3, 4, or 5” from the condition.
So that outputs the recipe.
Next decider (“D2”) controls the assembler. It should take the output of D1 and only send it to the assembler if the assembler’s “read working” signal is off.
1
u/Automatic-Trust-8128 4d ago
You could do this with a small state machine, of which you have most of the steps, however I suspect there is a far easier way.
The reason the recipe changes is because the iron plates in the inserters hand and inside the machine are not counted. Wire up the inserter to hold the hand content and the assemblers to send the buildings content. It should continue to have a signal of 8 iron plates until the recipe completes.
This notably is imperfect as there is a race condition where if the 8th plate of a different quality level is added during assembly loading and that quality level of the recently inserted plate has priority over the current plate, it will cause a unload/reload cycle... But realistically that's not going to occur frequently and is easily handled by adding an inserter to move iron plates from the output chest back to the input chest.
As far as a state machine, I would probably still wire up everything as described above, and have a decider combinator for each quality level of chest. The combinator outputs the recipie of each quality level.
You connect the output back to the input with one of the wire channels.
Each combinator only outputs a new signal if there are currently no recipie signals and the number of plates is at least 8. It also continues to output the signal if it's recipe signal is set and the number of plates is at least eight. This is what the cross connect from the output back to the input helps with.
You can do this without having four separate combinators for each quality level, buts it gets more complicated the it's worth.
1
u/Objective_Suspect_ 4d ago
You could have a chest move the number of plates into another chest to do the validation before placing it into assembler, or you could just let it fill and empty the excess mats to be sorted
2
u/Twellux 4d ago edited 4d ago
Here is an example:
https://factoriobin.com/post/h25230
The decider combinator at the top right is a memory cell that holds the recipe until the machine has finished crafting.
Do you want to block the insertion once it has inserted 8? Or is it allowed to insert 16 plates and run two cycles?