The Logic Gate is a machine block which takes two keys as input and emulates another key based on the selected boolean operation.
Settings[]
Parameter | Default Value | Range | Conditions |
---|---|---|---|
Input A | [U] | Keys | - |
Input B | [I] | Keys | Operation has two inputs |
Condition | AND | AND, OR, NOR, NAND, XOR, XNOR, Random, SR Latch, D Latch, Counter, NOT | - |
Toggle Mode | False | Boolean | Operation is not SR Latch, D Latch, or Counter |
Emulate | [C] | Keys | - |
Usage[]
The Logic Gate presses and holds a key if the two input keys satisfy the set boolean condition (see #Truth Tables and Boolean Algebra).
The two levers on the face display the current inputs - red for inactive, green for active.
An indicator light on the face of the block turns on when the block is emulating a keypress.
It is not necessary to attach the logic gates to the machine; they will work just fine left lying on the ground. Especially considering their mass and how many you may need.
Logic gates cannot activate themselves.
Applications[]
A T flip flop (or toggleable memory cell) can be created by setting the condition to OR and enabling Toggle Mode. NOT can be used instead to make it active by default.
These can be combined with auto-return Steering Hinges or Toring for single-press retract/extend landing gear/flaps/doors/other mechanisms.
Another important use is combining the outputs of multiple other automation blocks. A simple example would be automatic landing gear which only extends below a certain speed and altitude, which could be created with an AND gate.
By routing controls through AND gates, it is possible to create multiple control mappings for the same keys.
For example, if you wanted to use only thrusters for VTOL control and only control surfaces for normal flight, this could be achieved by having multiple AND gates with the pitch, roll, and yaw controls as Input A, a single separate key as Input B, and the keys for the control surfaces set as the output.
Input B could then be set as the output of a T flip-flop; when toggled, that particular control mapping will be toggled on or off.
Truth Tables and Boolean Algebra[]
For these tables, 🟥 is Inactive/False, 🟢 is Active/True, and 'Keep' means it keeps the last actual setting:
A | B | AND | OR | NOR | NAND | XOR | XNOR | SR Latch | D Latch | |
---|---|---|---|---|---|---|---|---|---|---|
🟥 | 🟥 | 🟥 | 🟥 | 🟢 | 🟢 | 🟥 | 🟢 | Keep | Keep | |
🟥 | 🟢 | 🟥 | 🟢 | 🟥 | 🟢 | 🟢 | 🟥 | 🟥 | 🟥 | |
🟢 | 🟥 | 🟥 | 🟢 | 🟥 | 🟢 | 🟢 | 🟥 | 🟢 | Keep | |
🟢 | 🟢 | 🟢 | 🟢 | 🟥 | 🟥 | 🟥 | 🟢 | 🟥 | 🟢 |
A | NOT | Random | Counter | |
---|---|---|---|---|
🟥 | 🟢 | Keep | Keep | |
🟢 | 🟥 | ???? | 🟥🟥🟥🟢 |
Some operations are the inverse of other operations:
- NAND = NOT(AND)
- NOR = NOT(OR)
- XNOR = NOT(XOR)
SR Latch (set-reset) and D Latch (clocked) are memory; they are used to store information. OR gates with Toggle Mode on is a T flip-flop (which you might have used if you ever played Minecraft).
The Counter mode is a weird form of binary counter - it only activates if the total amount of keypresses is divisible by 4.
OR gates can be used to mix down six or more keys to a single key (which is great if mods or file editing aren't available). For three or less keys, just set the keys on the output block directly to get the same effect.
Random chooses a random state when pressed.
To get the most out of Logic Gates, it is essential to learn at least the basics of Boolean algebra - about how to formulate, express, and simplify boolean expressions. Particularly for complex machines, simplification is important - beyond bringing down the block count, each 'connection' between logic gates and other automation blocks requires an entire key, and keys are usually more limited than block count (particularly if you can't set them to non-keyboard keys!).
For those who do know their way around boolean algebra, Karnaugh_maps are one way to simplify expressions.
Technology[]
Some examples of logic gate applications:
- Some types of mechanical Engines use logic gates.
- Digital Swashplates can be built using logic gates.
- Walkers can use logic gates in place of mechanical systems for walk cycles.
- Autopilot systems can use logic gates to combine inputs from other automation blocks.
The Logic Gate is one of the most potent blocks in the game; on its own it might not be useful, but it allows so much more to be done with other blocks.
See Also[]
Starting Block • Wooden ( Small Block / Block / Pole / Log) • Brace • Smooth Surface Block | |
Joints ( Swivel / Ball / Hinge / Axle)
• Steering ( Hinge / Block)
• | |
Decoupler • Contractible Spring • Suspension • Slider • Piston • Spinning Block • Grabber • Winch | |
Metal Spike • Metal Blade • Circular Saw • Drill • Metal Jaw • Cannon • Shrapnel Cannon • Water Cannon • Crossbow • Vacuum • Flamethrower • Torch • Bomb • Remote Grenade • Explosive Rocket • Flaming Ball • Boulder | |
Timer • Logic Gate • Sensor • Altimeter • Anglometer • Speedometer • Length Detector • Pin Block • Camera Block | |
Flying Block • Propellers • Wing • Wing Panel • Ballast • Balloon | |
Armor Plates • Wooden Panel • Build Surface • Grip Pad • Plow • Half Pipe • Holder • Spike Ball |