Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bundleSide = "bottom" --White to door, Orange to "negative" noteblock, Magenta to "accept" noteblock
- password = "please open the door"
- debug_char = "0" -- leave nil to disable
- term.clear()
- function mainLoop()
- while(true) do
- event, driveSide = os.pullEventRaw()
- if(event=="disk" and driveSide) then
- path = disk.getMountPath(driveSide)
- if(path) then
- path = path.."/access" --reading from "access" file
- file = (fs.exists(path)) and io.open(path, "r") or nil
- end
- disk.eject(driveSide)
- if(file and file:read()==password) then
- for t=1,5,1 do
- rs.setBundledOutput(bundleSide, colors.white+colors.magenta)
- sleep(0.5)
- rs.setBundledOutput(bundleSide, colors.white)
- sleep(0.5)
- end
- rs.setBundledOutput(bundleSide, colors.orange)
- sleep(0.5)
- rs.setBundledOutput(bundleSide, 0)
- else
- rs.setBundledOutput(bundleSide, colors.orange)
- sleep(0.5)
- rs.setBundledOutput(bundleSide, 0)
- end
- if(file) then file:close() file = nil end
- elseif(debug_char and event=="char" and driveSide==debug_char) then return("break") end
- end
- end
- rs.setBundledOutput(bundleSide, 0)
- sfile = io.open("/startup", "w")
- sfile:write('shell.run("acr")')
- sfile:close()
- repeat
- ok, err, val = pcall(mainLoop)
- if(not ok and err) then
- if(err=="Terminated") then print("Access denied.")
- else print(err) end
- rs.setBundledOutput(bundleSide, 0)
- end
- until(ok and err=="break")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement