Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local event = require("event")
- local modem = component.modem
- local computer = require("computer")
- local door = component.os_doorcontroller
- local locked = false
- modem.open(255)
- function open()
- if not locked then
- door.open()
- end
- end
- function close()
- if not locked then
- door.close()
- end
- end
- component.redstone.setOutput(1, 0)
- function lock()
- locked = true
- component.redstone.setOutput(1, 1)
- end
- function unlock()
- locked = false
- component.redstone.setOutput(1, 0)
- end
- local name = "lowsec"
- while true do
- local event, a, b, c, d, e = event.pull()
- if event == "modem_message" then
- if e == name.."_open" then
- print("[M] Opening...")
- open()
- elseif e == name.."_close" then
- print("[M] Closing...")
- close()
- elseif e == name.."_lock" then
- print("[M] Locking...")
- lock()
- elseif e == name.."_unlock" then
- print("[M] Unlocking...")
- unlock()
- elseif e == name.."_beep" then
- print("[M] Beeping...")
- computer.beep(500,1)
- end
- end
- if event == "redstone_changed" then
- if d == 15 then
- print("[R] Opening...")
- open()
- elseif d == 0 then
- print("[R] Closing...")
- close()
- end
- end
- if event == "magData" then
- print("[C] Card swiped!")
- local data = b
- modem.broadcast(256, name.."_mdata", data)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement