Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local integrator = peripheral.find("redstoneIntegrator")
- local envd = peripheral.find("environmentDetector")
- integrator.setOutput("bottom",true)
- list_ = fs.open("allow_list.txt","r")
- list = textutils.unserialize(list_.readAll())
- list_.close()
- function eepy(t)
- local timer_id = os.startTimer(t)
- local event, id
- repeat
- event, id = os.pullEvent("timer")
- until id == timer_id
- end
- function has(table,compare)
- for _,b in pairs(table) do
- if b == compare then
- return true
- end
- end
- return false
- end
- open = false
- while true do
- open = false
- term.clear()
- input = rs.getInput("back")
- if input == true then
- entities = envd.scanEntities(5) or {}
- for _,tab in pairs(entities) do
- for type,data in pairs(tab) do
- if type == "name" then
- if has(list,data) then
- -- print(data)
- integrator.setOutput("bottom",false)
- open = true
- term.clear()
- term.setCursorPos(1,1)
- os.queueEvent("Accès", "accordé")
- eepy(2)
- integrator.setOutput("bottom",true)
- end
- end
- end
- end
- else
- if input == false then
- eepy(0.05)
- else
- os.queueEvent("Accès", "refusé")
- eepy(2)
- end
- end
- end
- if not open then
- integrator.setOutput("bottom",true)
- end
Advertisement
Add Comment
Please, Sign In to add comment