Scrap Mechanic Wiki
Advertisement
Logic Gate
Logicgate
Overview
CategoryInteractive
Weight
Durability
Friction
Buoyancy
FlammableNo

Logic Gate is part of the Program Node family in Scrap Mechanic.

Overview[ | ]

Logic Gate Blocks

Logic Gates are used to process binary signals (1 - ON or 0 - OFF). Logic Gates can receive input from Buttons, Switches, Sensors, Timers and other Logic Gates. A Logic Gate processes one or more inputs to produce an output. The face of the Logic Gate indicates the state of its output: when the output of a Logic Gate is ON, the face of the block is illuminated.

Usage[ | ]

Logic Gates in Scrap Mechanic act like real-world logic gates, allowing for simple and complex electrical engineering.

Logic Gate UI

Logic Gates can be used to make creations ranging from simple two-button doors (as shown in the Handbook) to functioning computers. The Logic Gate block offers a selection of six gates: AND, OR and XOR as well as their inverses NAND, NOR and XNOR. The selected gate is displayed on the face of the block.

The connection path is critical on these blocks because they receive inputs and produce outputs. Inputs must be connected into a Logic Gate; outputs must be connected from the Logic Gate. Using two Logic Gate blocks as an example, connecting block two to block one means that the signal will be sent from block two to block one.

Advanced Use[ | ]

  • Logic Gates can be looped together to create latches or flip-flops. This means that Logic Gates can form memory circuits, storing a state (1 or 0).
  • A Logic Gate has an output delay of 1 tick (0.025 sec).
  • If you are planning a really complicated build, you might want to use the Scrap Mechanic Logic Gate Simulator.


Crafting[ | ]

MetalBlock1 CircuitBoard Glue
1 1 1
Arrowdown
00:20
00:12 (Level 5)
Craftbot
Arrowdown
LogicGate
1


Save/Load Behavior[ | ]

This section is only going to be of interest if you are building a circuit with a persistent state - such as a memory circuit or a repeating timer. For circuits based on the state of switches, then even if the save/load state is wrong, it'll only last for a couple ticks anyway. In memory circuits, the surprising save/load behavior can manifest as the circuit being in an unexpected state or wildly flashing when you reload. In circuits that include a timer, it usually manifests as a single-tick "true" signal in the middle of what should be a long period of "false" signals (or the other way around).

You might think that when you exit the game and come back that the logic gate would be in the same state that it was when you logged out. If not that, then it'd be wiped to zero on re-load. But it's actually neither of those. Logic gates and switches get restored to the state the gate was in the last time that either:

  • You took the build off a lift.
  • You painted the logic gate/switch.
  • You made or deleted a connection to the logic gate/switch.
  • (Survival mode) You left the area where the build was located.

This does not hold true for Timers, whose saved state is the state they were in when they were unloaded.

The act of placing a creation on a lift clears the saved state of all switches and logic gates, causing memory circuits to enter a glitched state. As mentioned above, taking creations off of the lift saves the state of all the logic gates and circuits on the creation. So, for example, if you have a simple memory circuit with a couple of buttons to toggle it on and off, then when you put it on the lift, it will be flashing wildly. If you then click a button while it's on the lift, then take it off the lift, that becomes its saved state. So, for example, if you switch it to the other state, exit the game and return, you will find it back in the state it was in when you took it off the lift.

History[ | ]

Beta[ | ]

Advertisement