Barotrauma

Barotrauma

Not enough ratings
Automatic smart doors
By Герой Бо Синн
Some doors are even smarter than me
Barotrauma Wiring Guide
   
Award
Favorite
Favorited
Unfavorite
Foreword
While looking around the internet to find some wiring tutorials I found this one:
https://steamcommunity.com/sharedfiles/filedetails/?id=2870254600
(very well made and large guide that can make your life on any submarine easier using some basic logic and electrical components)
I recommend anyone checking it first to better understand wiring.

In the beforementioned guide author suggested automatic water draining using regular doors, it uses simple logic and few components. However, it wasn't enough for what I planned to do. I wanted to make button doors(or doors with buttons):
  • Open by motion sensor
  • Open if there is a difference between water level in two water sensors (to redirect flow to larger pumps) and stay closed/close if either of sensors detects a high pressure.
  • Being able to open even if there is high pressure on the other side, while not triggerring motion sensors to open it for you when you don't want to.

The main issue with this is that doors with buttons are constructed on submarine editor level(this means there is no connection between buttons and doors that you can edit with in-game wiring, it complicates things). You cannot edit your sub mid-playthough and save everything you wired up and stored already.
I used a circuit box for cable management for each door (yes, I know, it's a lot of components, but with circuit boxes you can atleast move wiring over to new subs)
Actual Guide
You will need(for one door):
1xCircuit box(preferably)
1x Motion detector
2x Water detectors
8x Wires
1x Not
1x And
1x Greater
2x Relay
2x Or


Place your water detectors on each side of the door(or use existing ones), circuit box and motion detector.

Wiring part:

1) Connect each of the water detector's HIGH_PRESSURE values to circuit box INPUT_1 and INPUT_2.

2)Connect WATER_% of the water detector you want the excess water flowing FROM to circuit box INPUT_3.

3)Connect the other water detector (that you want the water flow TO) WATER_% to circuit box INPUT_4

4)Configure motion detector how you like. (Set it to Human. Ignore corpses)
Connect its OUTPUT to circuit box INPUT_5

5)Connect door's STATE_OUT output to circuit box INPUT_6

6)Connect circuit box OUTPUT_1 to door's SET_STATE

7)Connect circuit box OUTPUT_2 to door's TOGGLE_STATE

Now the circuit box wiring should look like this:


Circuit box part:

Place all of your components like this:


8) Connect SIGNAL_1 and SIGNAL_2 to the INPUT of the first OR component

9) Connect first OR SIGNAL_OUT to INPUT of NOT component and to INPUT_1 of AND component

10) Connect NOT SIGNAL_OUT to SET_STATE of the first RELAY component

11)Connect SIGNAL_3 to the SIGNAL_1_IN of the GREATER component
Make sure that output of GREATER component is set to 1.

12)Connect SIGNAL_4 to the SIGNAL_2_IN of the GREATER component

13)Connect SIGNAL_OUT of the GREATER component to the SIGNAL_1_IN of the second OR component

14)Connect SIGNAL_5 to SIGNAL_2_IN of the second OR component and SET_STATE of the second RELAY component

15)Connect SIGNAL_OUT of the second OR to SIGNAL_1_IN of the first RELAY component

16)Connect SIGNAL_6 to SIGNAL_2_IN of AND component

17) Connect OUTPUT of AND to SIGNAL_1_IN of the second RELAY

18) Connect first RELAY component SIGNAL_1_OUT to the SIGNAL_1_OUT of the circuit box

19) Connect first RELAY component SIGNAL_1_OUT to the SIGNAL_2_OUT of the circuit box

Now the circuit box should look like this:


If done correctly, the door will automaticly open if you pass nearby or the water is flowing from one side to the other, It will close if either water detector sees high pressure and it will no longer open by itself unless you fix the hole or open the door manually.
Afterword
I would be happy to hear your suggestions. For such a simple task this project takes way too many resources(considering you have more than one door on the sub)
If there are any cheaper solutions that deliver same results, I'll add it in and use myself.