Barotrauma

Barotrauma

Not enough ratings
null-stream-checker [wip]
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
290.973 KB
21 May, 2023 @ 8:18am
1 Change Note ( view )

Subscribe to download
null-stream-checker [wip]

Description
This is an assembly that should allow you to detect if there's a signal stream coming from a bus sensor, sensors which may output null.

The sensor bus (blue) must be connected to one input of an AND gate. You can have 5 sensors for 1 AND gate.
An oscillator emits a pulse at 60Hz and must be connected to the other input of the AND gate, which basically keeps asking the bus if there's any signal there. I have not noticed any desync issues between using multiple oscillators, but otherwise you can have 1 Oscillator per 5 AND Gates (25 sensors)
An OR gate topology then merges all AND gates. You'll need to add 1 OR gate per additional AND gate.

I have added 12 motion sensors with "1" for true and NULL for false as an example, if any of them triggers and sends a message to the bus then the detector will treat the signal by outputting "1" true. Ceasing movement in all sensors will silence the bus and the checker will handle this by outputting "0" false.

This may all actually be garbage because it mixes timing with signal merging which is mostly undefined behavior in barotrauma, but it may save you some components if it works :)
4 Comments
DuckieMcduck  [author] 8 Aug, 2023 @ 4:20pm 
Oh you're right, I didn't notice this behavior but it's also on the wiki :)
Can indeed swap this out with just an OR, or use the OR gate to handle null.
Thanks for speaking out!
DECAFBAD 8 Aug, 2023 @ 5:00am 
Not sending a signal or sending 0 is equivalent when you are sending to a LOGIC (!) component: that signal is discarded.
38 signals containing 0, being discarded, and 1 signal that is true will result in:
false OR false OR false OR false OR false ... OR false OR true
The result is: true, the OR component will send its programmed true value.

Only true for logic components, OR, AND, XOR.
DuckieMcduck  [author] 7 Aug, 2023 @ 5:03pm 
That won't work, because sending NULL is not considered falsy and will not inform you there's nothing in the bus. You'd merely trigger your system downstream and be unable to shut down.

This showcase shows you how to detect and handle NULL because it's basically always asking if there's something in the bus.
DECAFBAD 7 Aug, 2023 @ 4:35pm 
All you need is a single OR component, it will output the true value if anything sends 1 to either of the inputs. That means you can have 10 wires from sensors, even more if you connect them with WiFi components.