Advertisement
Rolcam

ComputerCraft Redstone Security Console

Jun 18th, 2020 (edited)
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. -- This program is designed to be used with the advanced door lock program I made. It can work standalone for other purposes
  2. -- Wiring Guide:
  3. -- Back:
  4. -- Yellow (input): Anti Tamper Line (have a fixed signal like a redstone block or torch always active)
  5. -- Purple (output): Alternate Alarm - Recommended for use to lockout other computers
  6. -- Orange (input): Alarm Trigger (for panic buttons/pressure plate traps)
  7.  
  8. -- Top:
  9. -- Black (output): Sends a signal when the program starts (useful for keeping computers/buttons/whatever locked until this is booted)
  10.  
  11. -- Bottom:
  12. -- Red (output): Security System/Main Alarm - Attach to sirens, security traps, lamps, whatever you want
  13.  
  14. os.pullEvent = os.pullEventRaw
  15. -- Set this to whatever side you want. It's strictly output
  16. rs.setBundledOutput("top", colors.black)
  17. term.clear()
  18. alarm = 0
  19. status = ("Unknown")
  20. -- 1: green | 2: red
  21. severity = 0
  22. while true do
  23.     term.setCursorPos(1,1)
  24.     term.setTextColor(colors.orange)
  25.     print("Redstone Alarm Panel V2")
  26.     term.setTextColor(colors.yellow)
  27.     term.setCursorPos(1,3)
  28.     term.write("Status: ")
  29.     if severity == 1 then
  30.         term.setTextColor(colors.green)
  31.     elseif severity == 2 then
  32.         term.setTextColor(colors.red)
  33.     else
  34.         term.setTextColor(colors.yellow)
  35.     end
  36.     term.write(status)
  37.     sleep(1)
  38.     -- Anti Tamper System
  39.     if redstone.testBundledInput("back", colors.yellow) == false then
  40.         redstone.setBundledOutput("bottom", colors.red)
  41.         severity = 2
  42.         status = "Tamper Alert!"
  43.     -- Checks for alarm trigger
  44.     elseif redstone.testBundledInput("back", colors.orange) == true then
  45.         redstone.setBundledOutput("bottom", colors.red)
  46.         redstone.setBundledOutput("back", colors.purple)
  47.         severity = 2
  48.         status = "Red Alert!   "
  49.     else
  50.         -- All clear
  51.         redstone.setBundledOutput("bottom", 0)
  52.         rs.setBundledOutput("back",0)
  53.         severity = 1
  54.         status = "All Clear    "
  55.     end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement