Page 1 of 1

Is there a way to have a value always, even when logistics = 0?

Posted: Thu Nov 21, 2024 4:00 am
by mooklepticon
For example, I'm requesting carbon from my space platform over Gleba. When there's no carbon in the logistic system, all the graphic displays are blank. When there is carbon, the roboport sends a signal of how many carbon are there. If there's 0 carbon, no signal is sent. (it's also connected to an inventory bar graph, but that's not necessary for this question.)

Roboport -> decider (* in, carbon out) -> display (*>=0, show*)

When carbon = 0, that display is blank. When carbon >0, then it shows carbon. I always want it to show carbon.

I could put a constant combinator in there, but then I'd have to set both it and the decider, but it seems inelegant.

Roboport, constant(carbon @ 1) -> decider (* in, carbon out) -> display (*>=0, show*)

That would work, because carbon will always be 1, but again it seems inelegant, and this game is all about elegant solutions.

Another example is when requesting things from the space platform. I have the roboport tell me how much carbon I have, multiply by negative 1, add that to the limit I want and then request that from the space platform. If I have 1000 carbon, *-1 is -1000, +5000=4000, so it's requesting 4000 carbon from the platform. When that is 0, it doesn't request anything. Since I'm using * to pass the carbon value thru the decider, when the value is 0, there's no signal sent.

Roboport -> decider (* in, carbon out) -> mult -1 -> add 5000 -> request that from platform.

Again, I can put a constant at 1 carbon and it works, but again, inelegant.


Is there a better way to pass the identity of carbon thru with a value of 0? (Because value 0 defaults to essentially "null" or "none" and doesn't pass the carbon item thru.

Re: Is there a way to have a value always, even when logistics = 0?

Posted: Thu Nov 21, 2024 5:02 am
by Stin
Use this combinator

it gives a 1 signal if the Red signal line has values with this signal and no value on the green signal line.

You can use a constant combinator with a signal list or the pre calculation values for the red input.

grafik.png
grafik.png (78.38 KiB) Viewed 150 times

Re: Is there a way to have a value always, even when logistics = 0?

Posted: Fri Nov 22, 2024 7:19 pm
by mooklepticon
Thanks! I couldn't quite understand it (combinators are hard for me) but I tried this and it works.
  • Constant combo has 1 of whatever (1 steel, here). This makes the TV show the steel, too.
  • math combo multiplies by each, so everything is 0, but the 1 from the const combo, so 1 steel * ## steel = ## steel
  • The next 2 math combos convert to a percent (1-100, bc factorio doesn't do decimals. 2nd math is just *100 and the 3rd math divides by my target amount.)
  • This feeds into the display.
Factorio combinator example.png
Factorio combinator example.png (199.65 KiB) Viewed 70 times