added Iris Password system
This commit is contained in:
70
display.lua
70
display.lua
@ -219,4 +219,74 @@ function display.showMainMenu()
|
||||
display.drawIrisStatus()
|
||||
end
|
||||
|
||||
---------------------------------------------
|
||||
-- PASSWORD PROMPT
|
||||
---------------------------------------------
|
||||
|
||||
function display.showPasswordPrompt()
|
||||
mon.setBackgroundColor(colors.black)
|
||||
mon.clear()
|
||||
mon.setTextScale(1)
|
||||
|
||||
mon.setBackgroundColor(colors.blue)
|
||||
mon.setCursorPos(7, 2)
|
||||
mon.write("IRIS PASSWORD")
|
||||
|
||||
mon.setBackgroundColor(colors.black)
|
||||
mon.setCursorPos(7, 5)
|
||||
mon.write("Enter Code:")
|
||||
|
||||
-- Draw number pad (3x4 grid)
|
||||
local oldterm = term.redirect(mon)
|
||||
|
||||
-- Numbers 1-9
|
||||
local row = 7
|
||||
for i = 1, 9 do
|
||||
local col = 8 + ((i - 1) % 3) * 5
|
||||
if (i - 1) % 3 == 0 and i > 1 then
|
||||
row = row + 3
|
||||
end
|
||||
paintutils.drawFilledBox(col, row, col + 3, row + 2, colors.green)
|
||||
mon.setCursorPos(col + 1, row + 1)
|
||||
mon.write(tostring(i))
|
||||
end
|
||||
|
||||
-- Bottom row: Clear (0), Zero, Enter
|
||||
paintutils.drawFilledBox(8, 16, 11, 18, colors.red)
|
||||
mon.setCursorPos(9, 17)
|
||||
mon.write("CLR")
|
||||
|
||||
paintutils.drawFilledBox(13, 16, 16, 18, colors.green)
|
||||
mon.setCursorPos(14, 17)
|
||||
mon.write("0")
|
||||
|
||||
paintutils.drawFilledBox(18, 16, 21, 18, colors.blue)
|
||||
mon.setCursorPos(18, 17)
|
||||
mon.write("OK")
|
||||
|
||||
term.redirect(oldterm)
|
||||
display.drawIrisStatus()
|
||||
end
|
||||
|
||||
function display.updatePasswordDisplay(password)
|
||||
mon.setBackgroundColor(colors.black)
|
||||
mon.setCursorPos(7, 6)
|
||||
mon.write(string.rep("*", #password) .. " ")
|
||||
end
|
||||
|
||||
function display.showPasswordResult(success)
|
||||
mon.setBackgroundColor(colors.black)
|
||||
mon.setCursorPos(7, 10)
|
||||
if success then
|
||||
mon.setTextColor(colors.green)
|
||||
mon.write("ACCESS GRANTED")
|
||||
mon.setTextColor(colors.white)
|
||||
else
|
||||
mon.setTextColor(colors.red)
|
||||
mon.write("ACCESS DENIED")
|
||||
mon.setTextColor(colors.white)
|
||||
end
|
||||
sleep(2)
|
||||
end
|
||||
|
||||
return display
|
||||
|
||||
Reference in New Issue
Block a user