Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local authorized = {}
- local authorizing
- local close
- local handle = io.open(".auth", "r")
- if handle then
- for user in handle:lines() do
- authorized[user] = true
- end
- handle:close()
- end
- while true do
- event = {os.pullEvent()}
- if event[1] == "biolock" then
- if authorized[event[2]] then
- if rs.getOutput("right") then
- --accept new authorized entry
- authorizing = true
- else
- rs.setOutput("right", true)
- close = os.startTimer(20)
- end
- elseif authorizing then
- authorized[event[2]] = true
- authorizing = false
- local handle = io.open(".auth", "w")
- if handle then
- for k, v in pairs(authorized) do
- handle:write(k.."\n")
- end
- handle:close()
- end
- end
- elseif event[1] == "redstone" then
- if rs.getInput("bottom") then
- rs.setOutput("right", false)
- end
- elseif event[1] == "timer" and event[2] == close then
- rs.setOutput("right", false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement