Factorio

Factorio

View Stats:
Spyderborg May 14, 2018 @ 3:32pm
Circuit network - number of items in chest?
Chests output all their contents to the circuit network. I want to set an alarm for when a chest gets too full, but all the reader devices will only let me choose a single item signal to read. I want the sum of ALL items in the chest, whether it's full of of only one item or full of multiple different items. How can I do this?
< >
Showing 1-8 of 8 comments
Teh Freek May 14, 2018 @ 3:57pm 
I haven't tried it, but you might be able to take one of the special signals (Each, Anything, Everything), multiply it by 1, and output it as a fixed signal. If nothing else the results should be interesting (and please do report them).
Half Phased May 14, 2018 @ 3:58pm 
As long as you know what exact items are going to be in the chest, use arithmetic combinators and add the together all the item counts in the chest. Have the output be a signal of T for example.

If you don’t know what exact items will be in the chest this won’t work as you have to program each combinator individually.
AlexMBrennan May 14, 2018 @ 5:28pm 
I want the sum of ALL items in the chest,
Arithemetic combinator, "EACH+0", output N.

However, that won't actually do what you want. The problem is that different items have different stack sizes - e.g. 100 iron plates take up 1 slot, 100 steam engines take up 10 slots, 100 artillery shells take up 100 slots. To find out the number of used slots, you need to take the inputs, divide them by the stack size (using one combinator per item), round up, and then add them all together.

Without a pairwise combinator (multiply each signal on the green wire by the matching signal on the red wire), I can't see a way of doing this in a way that wouldn't require comically massive combinator arrays.
THE kilroy May 15, 2018 @ 2:48am 
I dont know if this helps, but you can make a roboport output the item contents of the network it belongs to. probably irrelevant to your situation but it might help with an alarm.

Also you can use inserter connected to the chest to disable loading at a certain capacity instead of alarming.

Sorry if this doesnt apply
Hedning May 15, 2018 @ 3:12am 
Originally posted by AlexMBrennan:
Without a pairwise combinator (multiply each signal on the green wire by the matching signal on the red wire), I can't see a way of doing this in a way that wouldn't require comically massive combinator arrays.
I have never done this, and there is probably a more elegant solution, but there aren't that many different possible stack sizes so you can use constant combinators to group items of same stack size and then "only" have to divide each group by their stack size.
AlexMBrennan May 15, 2018 @ 4:27am 
Good point. Something as "small" as this ought to work:
https://steamcommunity.com/sharedfiles/filedetails/?id=1386495690
0eNrtmv9umzAQx9/F0v6ZyIYvECCa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UZH2jl6fYzgozEGiOyaxUjnu4gESXlto0rB20Wp/nV/WehnqvdzqNydyVOID1X2T2mRsT3CHJioXTPK33jNmwhyYBPkd1D+uArwqspTyUbRsJP+RrMPnRb7xuvJRHRCW+HI1fXiKsqRwZJBjWpt5FcOsLHF5ur6cBVsBksEGGFDfs4AkZVqBP9Fo+mSa0k0wip6EFux+S/ozdRRi2psuKDGRpfYqZztVtrtyWe5HnlSy3L/pWocAUASRHHQtr8BHMP5hA==
You will have to adjust the divisor (column 4&5) based on your stack size (can't be bothered to remove my mods) and add more rows.

Is that what you meant or is there a more efficient way to filter signals?
Last edited by AlexMBrennan; May 15, 2018 @ 5:21am
Hedning May 15, 2018 @ 5:13am 
That looks to be exactly what I meant :)
But like I said this was just what I thought of right away. There may be a much better way.
Interesting solutions so far, always great to see your advanced use of circuits!
Being lazy, I went for a far simpler solution and came up with this proof of concept:
https://steamcommunity.com/sharedfiles/filedetails/?id=1386569930
The idea is that once the storage chests start to fill up, the belt will also fill up. The combinator simply counts the amount of items on the belt and the speaker will inform the player once a certain threshold is reached.
It's very basic but at least you don't have to adjust any stack sizes ;)
0eNrVWUuSrCgU3UoF09YOEc3f7K3hDV9UGJhSmUShGIDZnVHhAnohvbFeSV80f2VKPXFUTipLwAP3XO7XD5SLhtWKVwbtPhDfy0qj3a8PpPmhosKOmXPN0A5xw0oUoIqW9knIA9eG78P9kWkTaiMVPTDUBohXBfsb7XD7GiBWGW446xG7h3NWNWXOFCz4HVaAaqnhdVnZUwBkuArQGX5i2CWnABG1wRNs7A+bToAl/rDJBNjkBvtGAcwoWulaKhPmTJhnTHKHLLhi+34KQEBtRkmR5exIT1wqu37P1b7hJmMVzQXLCq7tL9q9UaFZcJtWjBbZkVZFZkHgfKAto5qHFdfxfmkpC2bV221a9WfQdj9s/yhWPCqbw1P6ILd9jqP2tW1HyEj9yEhGyVh9bzKSARkrBxcrPy7SJXKROmRf32TXhu7fQ15ppgzMOE0XDwxiBHQzHXQ1GXTrp6ULcrQoLWGXueLIU/p0gdJvB/aKiYuNezwrWcGbMmQC8BUEilqKsfhArtdsDC2efl2TydcVE0+NJcu8rwOVJS6VeUbfi8YWRgcZ0uFyu9gz/obxEukYBmDsisDYMwSHeIl0DJMzvHbRsfajI1oiG6shGxsXGxs/NhZ5N9bDxB272NjOKWOWxUYcPbPxeYDEDnriaFaVhxdV5T351a2LDezHxiKjzGYyGw+JXkmF+F3WeM3IxqDI5JxxetkUJ96Nj/SLI6a+VdhodhyvfCvEcZj13F7R1x2ozdzO1tewW9+SYFRoEs3tZH3dH7tbNVXcHEvWAcsy5xUFYJdd4z/TdtyW7zDWGgt+M7o3rrTJnvqTJ65MAyN3lroVIaP7o+1LamZhLBbQZ7udQISsmaL9mdAf8KZsTN14YP9A1qinegVia8cAxa5pVyZK4jnxA7ff3EcOS2viKq0JmSN//M3ltxZzher4eE4nBgOuwo0kc5qFy+oVuoWf1TVemPDDGp64WhrkHhlrJQ+KlqU9cqhrRt/HQkUyyVfcHPAM//sD9eAXr7uN7FNZU9WFhR36759/uxWXrewEeH2mOkZ6jOxERcMyrrOaG/DmVwVABASeS+Cgz8hha2nYpa8+3xK7PB6Y+nSSWtBzDmE3O0nRWPngpdvYQcgckrfzVe/wv/wrgwzuXB9ldb4cuLUTELKHMh5hbTdxfb0bkVVW0vo6ZD/MXTjvzuj9Wa7fuWRa24Ed+tlPvXQL9ctbIwQavVFrz6wSso7XoD/W7uHjYoBOIG9vbZt1HMfbZL1J2vZ/YvsCUA==
Also it can be expanded easily by simply adding chests and belts at the end and increasing the threshold for the alarm...
Last edited by Brawndo - The Thirst Mutilator; May 15, 2018 @ 7:57am
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: May 14, 2018 @ 3:32pm
Posts: 8