Advertisement
DOGGYWOOF

Untitled

Jan 15th, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.60 KB | None | 0 0
  1. local w, h = term.getSize()
  2.  
  3. -- Function to center text horizontally
  4. local function centerText(y, text)
  5. local x = math.floor((w - #text) / 2)
  6. term.setCursorPos(x, y)
  7. term.write(text)
  8. end
  9.  
  10. -- Function to draw the spinner animation
  11. local function drawSpinner(x, y, duration)
  12. local spinnerFrames = {
  13. "[ ]",
  14. "[= ]",
  15. "[== ]",
  16. "[=== ]",
  17. "[====]",
  18. "[ ===]",
  19. "[ ==]",
  20. "[ =]",
  21. "[ ]",
  22. "[ =]",
  23. "[ ==]",
  24. "[ ===]",
  25. "[====]",
  26. "[=== ]",
  27. "[== ]",
  28. "[= ]"
  29. }
  30. local delay = 0.1
  31. local frameCount = #spinnerFrames
  32.  
  33. local spinnerX = x
  34. local spinnerY = y
  35.  
  36. local spinnerIndex = 1
  37. local startTime = os.clock()
  38. while os.clock() - startTime < duration do
  39. term.setCursorPos(spinnerX, spinnerY)
  40. term.write(spinnerFrames[spinnerIndex])
  41.  
  42. spinnerIndex = spinnerIndex % frameCount + 1
  43. os.sleep(delay)
  44. end
  45. end
  46.  
  47. -- ASCII art dog image
  48. local dogImage = {
  49. " |\\_/| ",
  50. " | @ @ Doggy OS ",
  51. " | <> _ ",
  52. " | _/\\------____ ((| |))",
  53. " | `--' | ",
  54. " _____|_ ___| |___.' ",
  55. "/_/_____/____/_______| "
  56. }
  57.  
  58. -- Function to draw the ASCII art
  59. local function drawASCIIArt(y)
  60. for i, line in ipairs(dogImage) do
  61. centerText(y + i - 1, line)
  62. end
  63. end
  64.  
  65. -- Function to show UEFI messages
  66. local function showUEFIMessage(message)
  67. term.setBackgroundColor(colors.black)
  68. term.clear()
  69. term.setTextColor(colors.white)
  70. local artHeight = #dogImage
  71. local artY = math.floor((h - artHeight) / 2)
  72. drawASCIIArt(artY)
  73.  
  74. local messageY = artY + #dogImage + 2
  75. centerText(messageY, message)
  76. end
  77.  
  78. -- Function to display startup options menu
  79. local function showStartupMenu()
  80. term.setBackgroundColor(colors.black)
  81. term.clear()
  82. term.setTextColor(colors.white)
  83. centerText(math.floor(h / 2) - 2, "Startup Options")
  84.  
  85. local options = {
  86. "1. Safe Mode",
  87. "2. Debugging Tools",
  88. "3. Normal Boot"
  89. }
  90.  
  91. for i, option in ipairs(options) do
  92. centerText(math.floor(h / 2) + i - 1, option)
  93. end
  94.  
  95. centerText(h - 1, "Press a number to select an option.")
  96.  
  97. while true do
  98. local event, param = os.pullEvent("key")
  99. if param == keys.one then
  100. return "safe"
  101. elseif param == keys.two then
  102. return "debug"
  103. elseif param == keys.three then
  104. return "normal"
  105. end
  106. end
  107. end
  108.  
  109. -- Placeholder function for boot options
  110. local function loadBootOptions()
  111. local mode = showStartupMenu()
  112.  
  113. if mode == "safe" then
  114. showUEFIMessage("Booting into Safe Mode...")
  115. os.sleep(2)
  116. elseif mode == "debug" then
  117. showUEFIMessage("Launching Debugging Tools...")
  118. os.sleep(2)
  119. elseif mode == "normal" then
  120. showUEFIMessage("Starting Normal Boot...")
  121. os.sleep(2)
  122. end
  123. end
  124.  
  125. -- Placeholder function for boot animation
  126. local function loadBootAnimation()
  127. term.setBackgroundColor(colors.black)
  128. term.clear()
  129.  
  130. term.setTextColor(colors.white)
  131. local artHeight = #dogImage
  132. local artY = math.floor((h - artHeight) / 2)
  133. drawASCIIArt(artY)
  134.  
  135. -- Calculate spinner position
  136. local spinnerX = math.floor(w / 2) - 3
  137. local spinnerY = artY + artHeight + 2
  138.  
  139. -- Start spinner animation
  140. drawSpinner(spinnerX, spinnerY, 9) -- Spinner runs for 9 seconds
  141. end
  142.  
  143. -- Main function
  144. local function main()
  145. showUEFIMessage("Press DEL to show startup options")
  146. local timer = os.startTimer(2.5) -- Set a timer for 2.5 seconds
  147.  
  148. while true do
  149. local event, param = os.pullEvent()
  150. if event == "key" and param == keys.delete then
  151. -- If DELETE key is pressed, load boot options
  152. showUEFIMessage("Loading startup menu...")
  153. os.sleep(2.5)
  154. loadBootOptions()
  155. return
  156. elseif event == "timer" and param == timer then
  157. -- If timer expires, load boot animation
  158. loadBootAnimation()
  159. return
  160. end
  161. end
  162. end
  163.  
  164. -- Run the main function
  165. main()
  166.  
  167. -- Clear screen after shutdown
  168. term.setBackgroundColor(colors.black)
  169. term.clear()
  170.  
  171. -- Load lockscreen
  172. if fs.exists("disk/os/lock.lua") then
  173. shell.run("disk/os/lock.lua")
  174. else
  175. term.setTextColor(colors.red)
  176. centerText(math.floor(h / 2), "Error: lock.lua not found!")
  177. os.sleep(3)
  178. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement