Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Clear the screen and set up colors
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- -- Define the width and height of the screen
- local width, height = term.getSize()
- -- Helper function to center text on the screen
- local function centerText(y, text, textColor)
- local x = math.floor((width - #text) / 2)
- term.setCursorPos(x, y)
- term.setTextColor(textColor)
- term.write(text)
- end
- -- Helper function to display text at a specific position
- local function displayText(x, y, text, textColor)
- term.setCursorPos(x, y)
- term.setTextColor(textColor)
- term.write(text)
- end
- -- Function to display the error screen
- local function displayErrorScreen()
- -- Display the dog ASCII art with red Xes for eyes
- local dogArt = {
- " |\\_/| ",
- " | X X RECOVERY ERROR! ",
- " | <> _ ",
- " | _/\\------____ ((| |))",
- " | `--' | ",
- " _____|_ ___| |___. ",
- "/_/_____/____/_______| "
- }
- local startLine = math.floor((height - #dogArt) / 2) - 2
- -- Display the dog ASCII art with red Xes for eyes in red
- term.setTextColor(colors.red)
- for i, line in ipairs(dogArt) do
- centerText(startLine + i, line, colors.red)
- end
- -- Display updated error message below the dog ASCII art in white
- term.setTextColor(colors.white)
- centerText(startLine + #dogArt + 2, "System Recovery Disabled", colors.white)
- centerText(startLine + #dogArt + 3, "Error: /recovery/ cannot be mounted", colors.white)
- -- Display "F1 - Ignore" on the left side, closer to the bottom
- displayText(3, height - 2, "F1 - Ignore", colors.white)
- -- Display "F8 - Attempt Repairs" on the right side, closer to the bottom
- displayText(width - #("F8 - Attempt Repairs") - 3, height - 2, "F8 - Attempt Repairs", colors.white)
- -- Wait for user input
- while true do
- local event, key = os.pullEvent("key")
- if key == keys.f1 then
- -- Run BIOS if F1 is pressed
- shell.run("/disk/boot/BIOS")
- break
- elseif key == keys.f8 then
- -- Attempt repairs if F8 is pressed
- shell.run("/disk/error/repair-recovery")
- break
- end
- end
- end
- -- Main program logic
- if fs.exists("/recovery") then
- -- If /recovery exists, run the BIOS
- shell.run("/disk/boot/BIOS")
- else
- -- If /recovery does not exist, display the error screen
- displayErrorScreen()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement