Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local name
- local comp = require("component")
- local r = comp.redstone
- local s = require("sides")
- local event = require("event")
- local os = require("os")
- local term = require("term")
- local gpu
- for addr, _ in comp.list("gpu") do
- if addr ~= comp.getPrimary("gpu") then
- gpu = comp.proxy(addr)
- end
- end
- local auth = {"XDjackieXD", "Ristelle", "copygirl", "modmuss50", "unascribed", "Vexatos"}
- gpu.bind("bfb28621-1897-4634-a2b8-e4ab87211370")
- gpu.setResolution(16, 8)
- local function draw_default()
- gpu.setForeground(0xFFFFFF)
- gpu.setBackground(0x000000)
- gpu.fill(1,1, 16,8, " ")
- gpu.set(6,4, "Click")
- gpu.set(7,5, "Me!")
- end
- local function draw_ok()
- gpu.setForeground(0x000000)
- gpu.setBackground(0x00FF00)
- gpu.fill(1,1, 16,8, " ")
- gpu.set(6,4, "Access")
- gpu.set(5,5, "Granted!")
- end
- local function draw_nok()
- gpu.setForeground(0x000000)
- gpu.setBackground(0xFF0000)
- gpu.fill(1,1, 16,8, " ")
- gpu.set(6,4, "Access")
- gpu.set(6,5, "Denied")
- end
- local function has_value (tab, val)
- for index, value in ipairs(tab) do
- if value == val then
- return true
- end
- end
- return false
- end
- term.clear()
- print("Auth log:")
- while true do
- draw_default()
- _, _, _, _, _, name = event.pull("touch", "bfb28621-1897-4634-a2b8-e4ab87211370")
- if has_value(auth, name) then
- print("ok: " .. name)
- draw_ok()
- r.setOutput(s.east, 15)
- os.sleep(1)
- r.setOutput(s.east, 0)
- else
- print("failed: " .. name)
- draw_nok()
- os.sleep(1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement