Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------- startup class --------------
- local attemptsLeft = 3
- local function checkLock(side)
- if redstone.getInput(side) == true then
- term.clear()
- term.setCursorPos(18,9)
- print("TERMINAL LOCKED")
- term.setCursorBlink(false)
- sleep(5)
- os.shutdown()
- end
- end
- local function main()
- term.clear()
- term.setCursorPos(1,1)
- print("Open, close, or Reset Password? (o/open, c/close, or r/reset)")
- input2 = string.lower(read())
- if input2 == "o" or input2 == "open" then
- shell.run "OPEN"
- os.shutdown()
- elseif input2 == "c" or input2 == "close" then
- shell.run "CLOSE"
- os.shutdown()
- elseif input2 == "r" or input2 == "reset" then
- term.clear()
- term.setCursorPos(1,1)
- print("Old Password:")
- input3 = read()
- if input3 == pass then
- term.clear()
- term.setCursorPos(1,1)
- print("New Password:")
- password = io.open("password", "w")
- password:write(read())
- password:close()
- print("Reset!")
- sleep(2)
- os.shutdown()
- else
- print("Incorrect")
- sleep(2)
- os.shutdown()
- end
- else
- return
- end
- end
- local function shutdown()
- print("Shut down? (y/yes or n/no)")
- input2 = string.lower(read())
- if input2 == "y" or input2 == "yes" then
- print("Shutting down...")
- sleep(2)
- os.shutdown()
- else
- main()
- shutdown()
- end
- end
- term.clear()
- term.setCursorPos(1,5)
- print(" ______________________________________________\n | _____ _____ _ _____ _____ |\n | | __| __| |_ ___ ___ ___ | | __| |\n | | | |__ | _| . | _| -_| | | |__ | |\n | |_____|_____|_| |___|_| |___| |_____|_____| |\n |______________________________________________|\n\n Made by Spectrewiz\n V1.4")
- sleep(1)
- while attemptsLeft > 0 do
- term.clear()
- term.setCursorPos(1,1)
- password = io.open("password")
- pass = password.read("*all")
- password:close()
- PasswordText = "Password: Attempts Left: "
- for i = 1,attemptsLeft - 1,1 do
- PasswordText = PasswordText .. "* "
- end
- print(PasswordText)
- input = read()
- if input == pass then
- main()
- shutdown()
- else
- print("Incorrect")
- attemptsLeft = attemptsLeft - 1
- sleep(1)
- end
- end
- term.clear()
- term.setCursorPos(14, 9)
- print("Notifying Administrator...")
- redstone.setOutput("top", true)
- sleep(5)
- redstone.setOutput("top", false)
- os.shutdown()
- -------------- OPEN class --------------
- local function frame(motor)
- if motor == "up" then
- redstone.setBundledOutput("left", colors.blue)
- sleep(1)
- redstone.setBundledOutput("left", 0)
- sleep(1)
- elseif motor == "down" then
- redstone.setBundledOutput("left", colors.red)
- sleep(1)
- redstone.setBundledOutput("left", 0)
- sleep(1)
- end
- end
- for i = 1,2,1 do
- frame("down")
- end
- -------------- CLOSE class --------------
- local function frame(motor)
- if motor == "up" then
- redstone.setBundledOutput("left", colors.blue)
- sleep(1)
- redstone.setBundledOutput("left", 0)
- sleep(1)
- elseif motor == "down" then
- redstone.setBundledOutput("left", colors.red)
- sleep(1)
- redstone.setBundledOutput("left", 0)
- sleep(1)
- end
- end
- for i = 1,2,1 do
- frame("up")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement