Advertisement
DOGGYWOOF

Untitled

Jan 1st, 2025 (edited)
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. local monitor = peripheral.wrap("right") -- Wrap the monitor on the right
  2. local w, h = term.getSize()
  3.  
  4. -- Function to center text horizontally
  5. local function centerText(y, text, output, width)
  6. local x = math.floor((width - #text) / 2)
  7. output.setCursorPos(x, y)
  8. output.write(text)
  9. end
  10.  
  11. -- Function to draw the spinner animation
  12. local function drawSpinner(x, y, duration, output, monitor, monitorSpinnerX, monitorSpinnerY)
  13. local spinnerFrames = {
  14. "[ ]",
  15. "[= ]",
  16. "[== ]",
  17. "[=== ]",
  18. "[====]",
  19. "[ ===]",
  20. "[ ==]",
  21. "[ =]",
  22. "[ ]",
  23. "[ =]",
  24. "[ ==]",
  25. "[ ===]",
  26. "[====]",
  27. "[=== ]",
  28. "[== ]",
  29. "[= ]"
  30. }
  31. local delay = 0.1
  32. local frameCount = #spinnerFrames
  33.  
  34. local spinnerIndex = 1
  35. local startTime = os.clock()
  36. while os.clock() - startTime < duration do
  37. -- Draw spinner on terminal
  38. output.setCursorPos(x, y)
  39. output.write(spinnerFrames[spinnerIndex])
  40.  
  41. -- Draw spinner on the monitor
  42. if monitor then
  43. monitor.setCursorPos(monitorSpinnerX, monitorSpinnerY)
  44. monitor.write(spinnerFrames[spinnerIndex])
  45.  
  46. -- Display "Connecting..." under the spinner
  47. monitor.setCursorPos(monitorSpinnerX - 4, monitorSpinnerY + 1)
  48. monitor.write("Connecting...")
  49. end
  50.  
  51. spinnerIndex = spinnerIndex % frameCount + 1
  52. os.sleep(delay)
  53. end
  54. end
  55.  
  56. -- ASCII art dog image
  57. local dogImage = {
  58. " |\\_/| ",
  59. " | @ @ Doggy OS ",
  60. " | <> _ ",
  61. " | _/\\------____ ((| |))",
  62. " | `--' | ",
  63. " _____|_ ___| |___.' ",
  64. "/_/_____/____/_______| "
  65. }
  66.  
  67. -- Function to draw the ASCII art
  68. local function drawASCIIArt(y, output, width)
  69. for i, line in ipairs(dogImage) do
  70. centerText(y + i - 1, line, output, width)
  71. end
  72. end
  73.  
  74. -- Function to draw the shutdown screen
  75. local function drawShutdownScreen(output, monitor)
  76. output.setBackgroundColor(colors.black)
  77. output.clear()
  78.  
  79. output.setTextColor(colors.white)
  80. local artHeight = #dogImage
  81. local artY = math.floor((h - artHeight) / 2)
  82. drawASCIIArt(artY, output, w)
  83.  
  84. if monitor then
  85. local monitorW, monitorH = monitor.getSize()
  86. monitor.setBackgroundColor(colors.black)
  87. monitor.clear()
  88. monitor.setTextColor(colors.white)
  89.  
  90. -- Adjust text scale for smaller size
  91. monitor.setTextScale(1.2)
  92.  
  93. -- Draw ASCII art on the monitor
  94. local monitorArtY = math.floor((monitorH - artHeight) / 2) - 2
  95. drawASCIIArt(monitorArtY, monitor, monitorW)
  96.  
  97. -- Calculate spinner position on the monitor
  98. local monitorSpinnerX = math.floor((monitorW - 6) / 2)
  99. local monitorSpinnerY = monitorArtY + artHeight + 1
  100. drawSpinner(math.floor(w / 2) - 3, artY + artHeight + 2, 9, output, monitor, monitorSpinnerX, monitorSpinnerY)
  101. else
  102. -- Calculate spinner position on the terminal
  103. local spinnerX = math.floor(w / 2) - 3
  104. local spinnerY = artY + artHeight + 2
  105. drawSpinner(spinnerX, spinnerY, 9, output, nil, nil, nil)
  106. end
  107. end
  108.  
  109. -- Main program
  110. if monitor then
  111. monitor.setTextScale(1.2) -- Smaller text scale for the monitor
  112. end
  113.  
  114. drawShutdownScreen(term, monitor)
  115.  
  116. -- Clear screen after shutdown
  117. term.setBackgroundColor(colors.black)
  118. term.clear()
  119.  
  120. -- Shutdown the computer
  121. shell.run("disk/os/lock.lua")
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement