Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- local auth_channel = 54321
- local reply_channel = 234
- local authCard = {}
- modem = peripheral.find("modem")
- if not modem then
- error("Modem not detected.")
- end
- local sides = peripheral.getNames()
- for k,side in pairs(sides) do
- if peripheral.getType(side) == "drive" then
- rSide = side
- reader = peripheral.wrap(rSide)
- end
- end
- if not reader then
- error("Card reader not detected.")
- end
- modem.open(reply_channel)
- while true do
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.blue)
- print("ProxyReader v1.5")
- print("scs.mtweather.mil")
- print("Authorized Users Only")
- print("Access Attempts are Logged")
- print("Please insert your Proxy Card...")
- diskHandle = os.pullEvent("disk")
- authCard = disk.getID(rSide)
- modem.transmit(auth_channel, reply_channel, authCard)
- local event, modem_side, authChan, replyChan, message = os.pullEvent("modem_message")
- if message == "valid" then
- disk.eject(rSide)
- term.setTextColor(colors.lime)
- print("Welcome!")
- print("Take your Proxy Card and enter.")
- local redSides = {"left", "right", "top", "bottom", "back", "front"}
- for i = 1, #redSides do
- redstone.setOutput(redSides[i], true)
- end
- sleep(3)
- for i = 1, #redSides do
- redstone.setOutput(redSides[i], false)
- end
- else
- disk.eject(rSide)
- term.setTextColor(colors.red)
- print("Not a valid proxy card.")
- sleep(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement