Wiring is an advanced feature, used to make Mechanisms functional. The following guide teaches you methods to make good use of Wires. Wires are extremely helpful in Terraria, as they can help you build farms, traps, and other things to help you advance the game.
Basics of Wiring
The two main components of a circuit are inputs and outputs. Examples of inputs would be timers, switches, or pressure plates. An input, when activated, will trigger every output mechanism (like a dart trap, statue, torch, or pump) that are wired to them. Wires are placed with the use of a Wrench, and can be destroyed with Wire Cutters. Most wiring components can be bought from the Mechanic.
There are (Desktop, Console and Mobile versions) four / (Old-gen console and 3DS versions) three different colors of wire, placed using any of the different colored wrenches, the Multicolor Wrench(Desktop, Console and Mobile versions), or The Grand Design(Desktop, Console and Mobile versions). The wire is still the same for all Wrenches: they are colored when placed. The wire colors are functionally identical, but they can't be connected: this allows more compact and complex circuitry to be designed. The Junction Box(Desktop, Console and Mobile versions) allows wires of the same color to cross without actually connecting, allowing even more complex and intricate wiring to be built.
- Switches and Levers work as inputs. They send a signal once every time they are toggled. It doesn't matter which direction they are flipped.
- Pressure Plates send a signal every time something walks over it. Stepping on the pressure plate activates it; for most plates, stepping off of it does nothing. The most effective use of pressure plates is enemy detection, be it for activating automated traps or just as an advanced warning so you can be ready to defend. Various kinds of pressure plates respond only to players, only to enemies, or to either. Weighted Pressure Plates are activated by a player stepping on or off of it. Projectiles and pets will not trigger most pressure plates; the exception is the Teal Pressure Pad.
- (Desktop, Console and Mobile versions) Sensors send a signal whenever a certain set of conditions are met. There are the following sensors:
- The Night Sensor sends a signal when day turns to night.
- The Day Sensor sends a signal when night turns to day.
- The Player Above Sensor sends a signal when the player enters its field of view, and again when it steps off.
- Liquid sensors trigger when they are submerged in either a particular liquid, or any liquid (according to sensor type).
- Most Light Sources can be turned on and off if they receive a signal.
- Doors will open or close upon receiving a signal. However, a door only gets signals from the blocks it is currently occupying. If wire runs only to a space that the door only occupies when open, a signal on that wire will close the door, but if the door is already closed, it will not receive the signal and will not open. This is useful for exits that need to be automatically closed for safety, without risking them opening accidentally.
- Many Statues can be activated to produce a creature or item whenever a signal is received, providing that enough time has passed since the previous activation. Not all statues can produce creatures: check the Functional statues section for more info.
- Actuators will change the state of the block that they're placed on when a signal is received. This allows you to create doors that are opened with a switch or lever. Also, trapdoors can be created so that lava pits and other traps can be covered when they aren't needed.
- Traps will activate when a signal is received, providing such action as dropping a spear from the ceiling or shooting out a jet of flame. The Traps page gives a full list, but the first trap most players will have access to is the Dart Trap: It fires a dart which travels quite far, damaging and poisoning whatever they hit, as well as clearing grass. Like statues, traps have a cooldown period after being triggered, and cannot be triggered again until that has passed.
- Explosives detonate when a signal is received. The explosion they cause is larger and much more damaging than that of Dynamite. They can be placed and detonated from a safe distance, making them a safer and more accurate solution than other block-damaging explosives, despite the effort of setting them up.
- Pumps are used to move large quantities of Water, Lava, or Honey: the Inlet Pump sucks in a liquid, and the Outlet Pump sends it out until it is completely submerged. Each time either pump is activated, the Inlet Pump will transfer up to four tiles of liquid to the Outlet Pump.
Timers, when activated, can repeat a signal with a specific delay: depending on the type, it will send a signal every one, three or five seconds. Unless you link timers together with different colored wire, timers can't be activated sequentially. Timers can be used to automate spawns and some mechanisms, notably Statues and Traps.
There are six different kinds of Logic gates: AND, OR, XOR, and their inverses NAND, NOR, and XNOR. Each gate only turns on when specific conditions are met:
- AND Gate becomes active only when all inputs are on. They're useful to restrict access to a particular area unless a player has flipped specific switches throughout the world.
- NAND Gate becomes active when all inputs are off, and is the reverse of an AND Gate.
- XOR Gate becomes active when the inputs are in a different state.
- XNOR Gate becomes active when both inputs are in the same state, and is the reverse of a XOR Gate.
- OR Gate becomes active when at least one input is on.
- NOR Gate becomes active when at least one input is off, and is the reverse of an OR Gate.
Their inputs must be in the form of Logic Gate Lamps placed in a line directly above the Logic Gate. There are 3 kinds:
- On starts on, switching to Off when it receives a signal.
- Off is the opposite.
- Faulty is a special kinds that sends a signal with chances equal to the number of on lamps below the first faulty lamp divided by the total number of lamps below it, never sending a signal if there are no lamps below it. See Logic_Gates#Faulty_lamps for more precisions.
There are multiple ways to create engines:
Hoik Engines and 'Hoiktronics'
It is possible to use Hoiks with wiring to create 'Hoiktronic' mechanisms using hoik mechanics - such as creating Hoik Engines. There is a guide in the forums that advanced players may find helpful An Introduction to Hoiktronics "Hoiktronic is intended to communicate the key use of the hoik glitch (with sloped blocks) to control the movement of NPCs so rapidly and precisely that they become somewhat like big, fat electrons, facilitating rapid digital mechanisms." Another useful guide is Fastest Engines, which includes: Hoiktronic Counter (Video), Crab Engine (Compact), Hoik Engines, House Hoik Engine, Teleporter Engines (Standard, Hoik Hybrid (Guide Engine, Hoik Hybrid (Ultimate, 1 Step)), Minecart Engines, Bird Engines, Rainstick Engines (Video included) (Stumps, Repeater, Spear Trap Batteries, Continuous Drop), 1.3 Update Notes (Including 'Ghost Dummy' Engines).
The Detonator is a 2×2 object that, when stepped on or right-clicked by a player, produces a signal. They're usually naturally found as a Trap.
Timers often "backfire" onto a mechanism, but with the Teal Pressure Pad and a Dart Trap it is possible to create a "diode", a wiring function which only works in one direction. Wire the source up to the Dart Trap, place the Pressure Pad directly in line, and wire the output up to it. This means that when it receives a signal, the Dart Trap fires, causing the Teal Pressure Pad to register a hit. However, because there is no continuous wire then whatever is rigged up to the Teal Pressure Pad will not re-activate the source.
In Hardmode, a simpler form of diode can be constructed: Any Logic Gate (except XOR) with a single Lamp on top. Wire the source to the lamp and the output to the gate.
It is possible to construct a mechanism out of a series of Logic Gates whose output signal will be triggered on every other input signal. Such mechanisms can be concatenated to produce a machine with the ability to count the number of inputs signals it receives. This may be used, for example, to count the number of days by attaching such a machine to a Logic Sensor (Day).
An easier/simpler implementation would be by using the Faulty Lamp atop a Logic Gate Lamp (on or off) so both Lamps get the same input which results in the gate sending a signal every second input.
Tip: When using the value of a counter with other circuitry you should keep in mind that the outputs of the counter may change multiple times in one cycle so you should delay (compensate) the output signals with one additional gate for every following counting node.