Logic Tutorial: Door with Lock

In this tutorial, you will learn how to create a door with a simple lock. This logic system demonstrates a simple but practical use of an AND gate.

Required logic cubes:


 * Cube model (x2)
 * Cube Model Hider (x2)
 * AND Cube (x1)
 * Negate Cube (x1)
 * Pressure Plate (x1)
 * Lever (x1)

Construction
To build the door with lock switch, build the example system in the image or follow these steps:


 * 1) Place the model to serve as a closed door.
 * 2) Place a cube model hider and connect it to the closed door model.
 * 3) Place a negate cube and connect it to the cube model hider.
 * 4) Clone the door model and rotate it into the position it would be if it were an open door.
 * 5) Place a new cube model hider and connect it to the open door model.
 * 6) Place an AND cube.  Connect the AND cube to the negate box and to the cube model hider for the open door.
 * 7) Place a pressure plate.  Adjust it to be close to the ground then move it under the closed door model.  Adjust the pressure plate to rest in the center of the door model, with an even amount of the pressure plate visible on both sides of the door.
 * 8) Place a lever.  Adjust it to be even with a wall on one side of the door.
 * 9) Connect the lever and the pressure plate to the AND cube.

To try to open the door, step on the pressure plate. If the lever is in the on position, the door will open. If the lever is in the off position, the door will stay closed. The door will only open if the AND cube receives power from the lever and the pressure plate. This is an example of a basic AND gate system.

This simple logic system is very customizable:


 * Practically any model can be used for the closed door and open door:
 * The open door model and its corresponding cube model hider can be removed entirely. In this system, the door will simply vanish when both the lever and pressure plate are active.
 * The closed door model and its corresponding cube model hider can be removed entirely. In this system, the door will appear when both the lever and pressure plate are active.
 * The door models can be replaced with platform models.


 * The pressure plate can be made invisible to create a better look.
 * The pressure plate can be replaced with a second lever or a target trigger.
 * The switch can be set to start at the on position in order to create a door that starts out unlocked.
 * The switch can be replaced entirely by a second pressure plate and toggle cube:
 * Simply connect the second pressure plate to the new toggle cube, and connect the blue orb of the toggle cube to the orange orb of the AND cube. In this system, the door will start out locked.
 * If you want the door to start out unlocked, delete the connection between the toggle cube and AND cube. Then place a new negate cube.  Connect the blue orb of the toggle cube to the orange orb of the negate cube, and connect the blue orb of the negate cube to the orange orb of the AND cube.
 * The switch can be replaced by a second pressure plate. In this system, the door will only open when both pressure plates are active at the same time.  Note that once someone steps off a pressure plate, the door will close.
 * The switch can be replaced entirely by a target trigger or a lock and key blueprint.