Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local integrator = peripheral.find("redstoneIntegrator")
- local envd = peripheral.find("environmentDetector")
- list_ = fs.open("allow_list.txt","r")
- list = textutils.unserialize(list_.readAll())
- list_.close()
- 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()
- term.setCursorPos(1,1)
- term.write("request health : [y]/[n]")
- term.setCursorPos(1,2)
- input = read()
- if input == "y" 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)
- term.write("access granted")
- sleep(2)
- integrator.setOutput("bottom",true)
- end
- end
- end
- end
- else
- if input == "n" then
- term.clear()
- term.setCursorPos(1,1)
- term.write("ok")
- sleep(2)
- end
- end
- end
- if not open then
- integrator.setOutput("bottom",true)
- end
Advertisement
Add Comment
Please, Sign In to add comment