Zero signal distinct from no signal
Posted: Mon Nov 07, 2016 6:14 pm
I'd like to have a signal with a count of 0 that is distinct from not having a signal at all for making better use of anything and everything conditions.
The long story:
Right now [0.14] all unused signals are 0 by default. That way signals that are 0 are treated to as it they wouldn't exist, no matter the source of the signal. Testing some conditions with anything and everything this leads to some unpleasant behavior:
Anything:
Using a constant combinator to send a signal of -1 or 1 iron ore triggers an anything > -2 condition, sending 0 doesn't. Checking for iron ore explicitly triggers the condition in all three cases, though. So anything only checks for nonzero values, which propably is the expected behavior in most cases because otherwise anything < 1 or anything > -1 would trigger basically always. But sadly this breaks in cases where 0 is a relevant value.
Everything:
The conditions everything = 1, everything > 1 and everything < 1 are met at the same time, if no signal at all is set and also if some circuitry calculates all values to be 0.
Proposal
A zero-signal would not be sent if a empty chest was connected, it would have to be created explicitly, for example by
- using a constant combinator
- as a result of an arithmetric combinator (except when using each)
- as a result from having a red wire and a green wire as an input, one having the value x, the other having -x.
- In general when the components of a sum "cancel each other out"
- filter insterters could also output an explicit zero for their filtered items (when they are not holding any)
- requester chests for requested items (when empty)
- other chests are more difficult, though: maybe this could be added by allowing to set filters (like in cargo wagons).
Usage example:
So if I have a chest which usually contains stacks of different materials and I want to check if any of these materials is empty, I could connect a constant combinator and then send zero-signals for all relevant materials. Now I can check for anything < 1.
I'd prefer getting rid of the constant combinator by having chests with filters which are able to send zeroes, or some other way, though.
A workaround right now is using a constant combinator to set an offset so the condition can always check for positive or negative values, but I'd prefer not having to do that, especially in more complicated cases.
I hope this was not posted before, but sadly it seems to be impossible to search for the word "zero".
The long story:
Right now [0.14] all unused signals are 0 by default. That way signals that are 0 are treated to as it they wouldn't exist, no matter the source of the signal. Testing some conditions with anything and everything this leads to some unpleasant behavior:
Anything:
Using a constant combinator to send a signal of -1 or 1 iron ore triggers an anything > -2 condition, sending 0 doesn't. Checking for iron ore explicitly triggers the condition in all three cases, though. So anything only checks for nonzero values, which propably is the expected behavior in most cases because otherwise anything < 1 or anything > -1 would trigger basically always. But sadly this breaks in cases where 0 is a relevant value.
Everything:
The conditions everything = 1, everything > 1 and everything < 1 are met at the same time, if no signal at all is set and also if some circuitry calculates all values to be 0.
Proposal
A zero-signal would not be sent if a empty chest was connected, it would have to be created explicitly, for example by
- using a constant combinator
- as a result of an arithmetric combinator (except when using each)
- as a result from having a red wire and a green wire as an input, one having the value x, the other having -x.
- In general when the components of a sum "cancel each other out"
- filter insterters could also output an explicit zero for their filtered items (when they are not holding any)
- requester chests for requested items (when empty)
- other chests are more difficult, though: maybe this could be added by allowing to set filters (like in cargo wagons).
Usage example:
So if I have a chest which usually contains stacks of different materials and I want to check if any of these materials is empty, I could connect a constant combinator and then send zero-signals for all relevant materials. Now I can check for anything < 1.
I'd prefer getting rid of the constant combinator by having chests with filters which are able to send zeroes, or some other way, though.
A workaround right now is using a constant combinator to set an offset so the condition can always check for positive or negative values, but I'd prefer not having to do that, especially in more complicated cases.
I hope this was not posted before, but sadly it seems to be impossible to search for the word "zero".