Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Note this program can work standalone, but the alarm panel program is recommended as it's designed to be used with this lock.
- -- Note: This is designed for rednet cables, but bundled cables from other mods should work too.
- -- Cabling Guide
- -- Back (Disregard if not using security program):
- -- Purple: Console Alarm Lock (from alarm panel/security monitor)
- -- Orange: Alarm Trigger (For alarm panel program)
- -- Right:
- -- White: Door Lock
- os.pullEvent = os.pullEventRaw
- x=1
- -- Main Program
- while true do
- -- Resets Timer (for added security)
- timer = 30
- rs.setBundledOutput("back",0)
- rs.setBundledOutput("right",0)
- -- Alarm
- if x == 4 or redstone.testBundledInput("back", colors.purple) == true then
- while timer > 1 do
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.red)
- rs.setBundledOutput("back", colors.orange)
- -- Displays Text if cause is from password attempts
- if x == 4 then
- print("Access Attempts Exceeded")
- term.setCursorPos(1,2)
- end
- -- Countdown Timer
- term.write("Lockdown Triggered for ")
- term.write(timer)
- term.write(" seconds")
- sleep(1)
- timer = timer - 1
- end
- rs.setBundledOutput("back", 0)
- x=1
- end
- -- Password Screen
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- write("Demo Access")
- term.setCursorPos(1,3)
- print("Enter Password:")
- local input = read("*")
- -- Password Check
- if input == "demo" then
- term.setTextColor(colors.green)
- print("Password Accepted")
- x=1
- redstone.setBundledOutput("right", colors.white)
- sleep(3)
- redstone.setBundledOutput("right", 0)
- -- Operator/Override code for maintenance
- elseif input == "operator"
- term.setTextColor(colors.blue)
- print("Welcome Operator! Program Terminated!")
- break;
- else
- term.setTextColor(colors.red)
- print("Password Incorrect")
- x=x+1
- sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement