Guide:Wiring

Wiring is an advanced feature, used to make Mechanisms functional. The following guide teachs you methods to make good use of Wires.

Basics
The two main components of a circuit are inputs and outputs. Inputs will activate every output mechanism to them one time when they are activated.

There are four different colors of wire, placed using any of the four different colored wrenches, the Multicolor Wrench, or The Grand Design. The Wire is still the same for all Wrenches: they are simply painted when placed. The four types are functionally identical, but they can't be connected: this allows more compact and complex circuitry to be designed. Also, the Junction Box allows wire to cross without actually connecting, allowing even more complex and intricate wiring to be built.

Inputs

 * Switches and Levers works as inputs. They send a signal once every time they are toggled. It doesn't matter which direction they are flipped.
 * Pressure Plates sends a signal every time something walks over it. Stepping on the pressure plate activates it; 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. Some pressure plates require a specific user to work (for example, a Player).
 * Sensors sends 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.

Outputs

 * Most Light Sources can be turned on and off if they receive a signal.


 * Doors will open or close upon receiving a signal. You can wire them to only close if you place the wire on a block that the door takes up when opened. If the door is closed, they will not receive the current and will not open. This is especially useful for exits that need to be automatically closed for safety, without risking them opening accidentally.


 * Statues that can be activated one time whenever a signal is received, providing that enough time has passed since the previous activation on that input. Not all statues can output: 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. This is the list of traps:
 * Dart Trap: it fires a dart, provided that enough time has passed since the previous activation. The darts have a 100% chance of poisoning whatever they hit, as well as doing simple damage and clearing grass. Their range is quite high.


 * Explosives detonate when a signal is received. The explosion they cause is slightly stronger than that of a Dynamite. They can be placed and detonated from a safe distance, making them a more accurate, yet not as simple to set up solution than other block-damaging explosives.


 * 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
Timers, when activated, can repeat a signal within 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. See https://www.youtube.com/watch?v=KhVgnlOidpY for how to build it.

Timers can be used with to automate the spawns some mechanisms, notably Statues and Traps.

Engines
 With Crab Statues or Bird Statues and pressure plates, you can create an engine, which can activate more frequently than a conventional Timer.

There are multiple ways on how to create engines:

Hoiktronics
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).

Detonators
The Detonator is a 2x2 object that, when stepped on or right-clicked by a player, produces a signal. They're usually naturally found as a Trap.

Diodes
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.

Counting Machines
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).