Advertisement
DOGGYWOOF

Kernel Power Loss screen

Sep 30th, 2024 (edited)
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. -- Clear the screen and set up colors
  2. term.clear()
  3. term.setBackgroundColor(colors.black)
  4. term.setTextColor(colors.white)
  5. term.clear()
  6.  
  7. -- Define the width and height of the screen
  8. local width, height = term.getSize()
  9.  
  10. -- Helper function to center text on the screen
  11. local function centerText(y, text, textColor)
  12. local x = math.floor((width - #text) / 2)
  13. term.setCursorPos(x, y)
  14. term.setTextColor(textColor)
  15. term.write(text)
  16. end
  17.  
  18. -- Function to display the error screen
  19. local function showErrorScreen()
  20. -- Display the dog ASCII art with red Xes for eyes
  21. local dogArt = {
  22. " |\\_/| ",
  23. " | ? ? KERNEL ERROR! ",
  24. " | <> _ ",
  25. " | _/\\------____ ((| |))",
  26. " | `--' | ",
  27. " _____|_ ___| |___. ",
  28. "/_/_____/____/_______| "
  29. }
  30.  
  31. local startLine = math.floor((height - #dogArt) / 2) - 2
  32.  
  33. -- Display the dog ASCII art with red Xes for eyes in red
  34. term.setTextColor(colors.red)
  35. for i, line in ipairs(dogArt) do
  36. centerText(startLine + i, line, colors.yellow)
  37. end
  38.  
  39. -- Display error message below the dog ASCII art in white
  40. term.setTextColor(colors.white)
  41. centerText(startLine + #dogArt + 2, "Kernel Power Loss", colors.white)
  42. centerText(startLine + #dogArt + 3, "", colors.white)
  43.  
  44. -- Move "Press F1 to continue boot" to the bottom in white
  45. centerText(height - 2, "Press F1 To continue boot", colors.white)
  46.  
  47. -- Listen for F1 key press to delete ACPI.signal and run /disk/boot/start-check.lua
  48. while true do
  49. local event, key = os.pullEvent("key")
  50. if key == keys.f1 then
  51. -- Delete ACPI.signal if it exists
  52. if fs.exists("/disk/boot/ACPI.signal") then
  53. fs.delete("/disk/boot/ACPI.signal")
  54. end
  55. -- Run /disk/boot/start-check.lua if it exists
  56. if fs.exists("/disk/boot/start-check.lua") then
  57. shell.run("/disk/boot/start-check.lua")
  58. end
  59. break -- Exit the loop after F1 is pressed
  60. end
  61. end
  62. end
  63.  
  64. -- Check if ACPI.signal exists
  65. if not fs.exists("ACPI.signal")
  66. then
  67. shell.run("delr.lua")
  68. showErrorScreen()
  69.  
  70. else
  71. shell.run("/disk/boot/start-check.lua")
  72.  
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement