Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --API's
- local cmpnt = require("component")
- local event = require("event")
- local colors = require("colors")
- --Components
- local red = cmpnt.redstone
- local graph = cmpnt.gpu
- --Variables
- local running = true
- local width, height = graph.getResolution()
- local string = "/dev/null"
- local char = "*"
- local password = {
- {1, 1, 1, 1},
- {1, 1, 1, 1},
- {1, 1, 1, 1},
- {1, 1, 1, 1}
- }
- --Component proxy
- local MainMonitor = cmpnt.proxy(cmpnt.get("fec2a1ea"))
- local MMResolution = {}
- MMResolution["x"], MMResolution["y"] = graph.getResolution()
- local DoorSection = {}
- DoorSection["RSIO"] = cmpnt.proxy(cmpnt.get("3a59ac5e"))
- DoorSection["Monitor"] = cmpnt.proxy(cmpnt.get("2578"))
- --Init
- graph.fill(1, 1, width, height, " ")
- --functions
- local function CheckPassword()
- for i=1, 4, 1 do
- for j=1, 4, 1 do
- if ( (graph.get(j, i) == "*" and password[j][i] == 0) or (graph.get(j, i) == " " and password[j][i] == 1) ) then return false end
- end
- end
- return true
- end
- --In
- graph.bind(DoorSection["Monitor"].address)
- graph.setResolution(50, 17)
- width, height = graph.getResolution()
- local function clearmon()
- graph.setForeground(0x000000)
- graph.setBackground(0xffffff)
- graph.fill(1, 1, width, height, " ")
- string = "ВВЕДИТЕ ПАРОЛЬ"
- graph.set(width/2-#string/2, 2, string)
- end
- clearmon()
- while running do
- local _, _, x, y, but = event.pull("touch")
- if (but == 1) then
- char = "*"
- elseif (but == 2) then
- graph.char = " "
- end
- graph.set(x, y, char)
- if (x == 1 and y == 1) then
- if (CheckPassword()) then
- DoorSection["RSIO"].setOutput(3, 1)
- os.sleep(2)
- DoorSection["RSIO"].setOutput(3, 0)
- end
- clearmon()
- end
- end
- --Out
- graph.bind(MainMonitor.address)
- graph.setResolution(MMResolution["x"], MMResolution["y"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement