Guide:Logic Gates

To new players or players who have never tinkered with wiring before, logic gates may seem complicated. Logic gates, however are very useful tools in Terraria for anyone wanting to construct advanced wiring creations. This guide assumes you already have basic knowledge of wiring. But, if you don't you can learn more about wiring here.

Basic Logic Gate Functions
There are six different kinds of logic gates: AND, OR, NAND, NOR, XOR, and XNOR. The letters represent what the gate does. AND requires all inputs to be true, and OR requires one or more input to be true. 'N' stands for not, which translates to the opposite of, so NAND requires the opposite of some inputs to be true, therefore becoming active as long as not all the inputs are true. NOR triggers when no input is true. 'X' means translates to 'exclusively', so XOR triggers when only one input is true, and XNOR triggers when more than one input is true- or otherwise when the total number of true inputs isn't one, the opposite of XOR.

AND Logic Gate


There are many things you can do with the AND Logic Gate. The AND Gate reacts only when all inputs are true, so it can be used to restrict access to a particular area unless a player has flipped specific switches throughout the world. It's also great for situations where more than one goal needs to be achieved before a player can move on.

Another use for the AND Gate is wire changing, that is the changing of the color of the wire. AND Gates are useful where one wire color must be used for the input, but another used for the output. A good example is a complicated teleporter hub that needs to be wired to a teleporter where other wires interfere. If you just have one input, the input value and output value will always be the same, (true or false, off or on.)

A third use for AND Gates is for something a player doesn't want happening before other things happen. For example, a player wouldn't want the inner door of their airlock in their underwater base to open before the water was pumped out AND the outer door was closed. Using an AND Gate, the player can wire it to only open the inner door if there isn't any water in the chamber AND the outer door is closed. This can be done using switches, but using the AND Gate, it becomes more streamlined.

OR Logic Gate
OR Logic Gates are useful when you want something to happen only after one of the inputs are triggered. For example in an adventure map, if you want players to only select one room, you may wire up an OR Gate to some pressure plates so that once they enter a room, they may still backtrack to the previous room, but not to the rooms they didn't choose.

The big idea with OR Gates is having to make a choice, while at the same time, shutting off other options once that choice has been made. However, OR Gates can be used when the player only has to complete one task, out of many, such as one parkour path out of four, in an adventure map for example. OR Gates can also be useful outside of adventure maps, for instance, if the player wants to wire an OR gate so that when day shifts to night or when an enemy comes into range of your defences, they turn on. This would be useful for discouraging any slimes or other daytime baddies from attacking you.