Here I described how to make 2 code locks, one is very simple and not safe and other one is more advanced and possibly the safest code lock you can make using mods so I recommend skipping first one.
Guide to Make Code Locks
Simple Code Lock
- First you need some switches and 3 logic gates Change red logic gate to NOR. Leave 2 other logic gates on and.
- Now connect all switches making your code to green logic gate and all wrong switches to red logic gate.
- Next connect red and green logic gate to white logic gate.
- White logic gate is the output so connect it to whatever you like, for example controller making your door more secure.
Advanced Code Lock
- First place keypad input, 2 tick buttons, math block, logic gate and 3 memory panels.
- Now click on math block until you find = function and change logic gate to OR.
- Then connect black tick button to black memory panel and keypad, black and white memory panel to math block, math block to logic gate and logic gate to whatever you need to have secured with code lock, for example door.
- If you’re making door, then place tick button and sensor on the other side.
- Connect sensor to black tick button (be sure that door will open to the other side than sensor) and tick button on the same side as sensor to orange tick button. Connect orange memory panel to orange tick button next to it and this tick button to logic gate.
- Next connect keypad to orange memory panel and click on it 1, 0, 0, ENTER and disconnect it.
- Then connect keypad to white memory panel, enter your code and disconnect.
- Last thing to do is to connect keypad to black memory panel and it’s done.
To change your code, simply input new code to white memory panel with keypad.
- Keypad opening door.
- Sensor closing door by deleting memory inside black memory panel and keyboard.
- Tick button on the other side opening door for 100 ticks.
- For those who still don’t know how to do it I uploaded code lock from tutorial screenshots on workshop here.