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
- -- Function to display the error screen
- local function showErrorScreen()
- -- Display the dog ASCII art with red Xes for eyes
- local dogArt = {
- " |\\_/| ",
- " | ? ? KERNEL 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.yellow)
- end
- -- Display error message below the dog ASCII art in white
- term.setTextColor(colors.white)
- centerText(startLine + #dogArt + 2, "Kernel Power Loss", colors.white)
- centerText(startLine + #dogArt + 3, "", colors.white)
- -- Move "Press F1 to continue boot" to the bottom in white
- centerText(height - 2, "Press F1 To continue boot", colors.white)
- -- Listen for F1 key press to delete ACPI.signal and run /disk/boot/start-check.lua
- while true do
- local event, key = os.pullEvent("key")
- if key == keys.f1 then
- -- Delete ACPI.signal if it exists
- if fs.exists("/disk/boot/ACPI.signal") then
- fs.delete("/disk/boot/ACPI.signal")
- end
- -- Run /disk/boot/start-check.lua if it exists
- if fs.exists("/disk/boot/start-check.lua") then
- shell.run("/disk/boot/start-check.lua")
- end
- break -- Exit the loop after F1 is pressed
- end
- end
- end
- -- Check if ACPI.signal exists
- if not fs.exists("ACPI.signal")
- then
- shell.run("delr.lua")
- showErrorScreen()
- else
- shell.run("/disk/boot/start-check.lua")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement