Wiring

From Official Barotrauma Wiki
Revision as of 19:26, 9 October 2020 by BTGamepedia>CyberMagos (Merging Connection Panels and Wiring)
Jump to: navigation, search

Template:Cleanup Wiring, also called electricity, is a central gameplay mechanics used for supplying power to various systems throughout the submarine and for creating complex devices.

Usage

Some items and devices can be connected to each other using wires (some devices are locked and their connections cannot be edited). The most obvious use of wiring is carrying power from the reactor to various devices, but wires can also carry various types of signals which can be used to build a wide range of complex systems. Think redstone in Minecraft.

Items that can be connected via wires have a connection panel, which can be accessed by selecting the item while holding a screwdriver in either hand. The connection panels can have several different connectors, each of which is marked with a label that describes what it does.

For example, doors have three connectors: toggle, set_state and state_out. If the "toggle"-connector receives a signal, the door closes/opens. If "set_state" receives a signal "0", the door closes, and if it receives "1", the door opens. "State_out" simply sends out "1" or "0", depending on whether the door is open or closed.

New wiring can be laid out by selecting an item while holding a screwdriver and a wire. The wire will be shown at the bottom of the connection panel, and it can be dragged to any of the connectors in the panel. After the wire is plugged in, the other end needs to be connected to some other item. This is done the same way as the first connection: when selecting another item, the other end of the wire will be shown at the bottom of the connection panel where it can be plugged in to the desired connection.

Some items and devices have a connection panel where wires can be plugged in. The panels can have several different inputs and outputs, some sending signals out depending on the state of the item and some controlling the item in one way or another.

Here's a list item components that can send or receive signals, and the different inputs and outputs of those components:

Any Itemcomponent

Label Type Description
activate, use input Uses the item whenever a signal is received. The effect is dependent on which type of itemcomponent it is and what kind of effects are assigned to the connection in the configuration file of the item.

Powered

All items that require power either have the "powered" item component or some subclass of it (OxygenGenerator, Pump, Engine...)

Label Type Description
power_in, power input Delivers power to the item, or in case of items with the PowerContainer or PowerTransfer component (Batteries, Junction Boxes), distributes it to other connected items. Power connections don't work with signal connections: connecting a power connection to a signal connection or vice versa does nothing.

Electrical Components

The connections in the electrical components are explained on their separate page.

Controller

Controller is a component that can make an item control other items. The most common use of the controller component are buttons.

Label Type Description
signal_out output Sends out "1" when the item is selected
trigger_out output Sends out "1" if the item is selected and the user left clicks. Used in railgun controllers for example: when the user wants to fire, the the component sends out a signal to the railgun
position_out output Sends out the cursor position of the user and focuses the camera on the connected item if the FocusOnSelected attribute of the item is set to true. Used in railgun controllers for aiming the railgun.

Door

Label Type Description
toggle input Closes/opens the door when any signal is received
set_state input Closes the door when a signal "0" is received and opens it whenever any other signal is received
state_out output Sends out "0" if the door is closed and "1" if it is open

Pump

Label Type Description
toggle input Turns the pump on/off whenever a signal is received
set_active input Turns the pump off when a signal "0" is received, and opens it when any other signal is received
set_speed input Sets the speed of the pump to the received value. The value is clamped between -100.0 and 100.0
set_targetlevel input Sets the target water level in the room to the received value. 0.0 means that the pump will try to empty the room completely, 50 means that it will try to fill the room half way and 100.0 means that it will try to fill the entire room with water. The value is clamped between 0.0 and 100.0

Steering

Label Type Description
velocity_x_out output Sends out the amount of steering along the x-axis. Clamped between -100.0 and 100.0 For example, if the submarine is being steered at full speed to the right, the output signal is 100.0. The most common use is to send the signal to the engine the move the submarine forwards and backwards.
velocity_y_out output Sends out the amount of steering along the y-axis, where down is the positive direction. Clamped between -100.0 and 100.0. For example, if the submarine is being steered straight down, the output signal is 100.0. The most common use is to send the signal to the set_targetlevel inputs of some pumps, making them fill up ballast tanks when diving and empty them when moving upwards.
velocity_in input Sets the steering velocity to the received value. The signal must contain the x-speed and y-speed separated with a comma, e.g. "-50,10".

Engine

Controller is a component that can make an item control other items. The most common use of the controller component are buttons.

Label Type Description
set_force input Sets the direction and power at which the engine tries to push the submarine. Clamped between -100.0 and 100.0. A signal of "100.0" would make the engine push the submarine forwards at full speed (assuming there is enough power) and "-100.0" backwards.

Gallery

Gallery of wiring interfaces and panels