Advertisement
DOGGYWOOF

Untitled

Jan 29th, 2025 (edited)
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 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.  
  6. -- Define the width and height of the screen
  7. local width, height = term.getSize()
  8.  
  9. -- Helper function to center text on the screen
  10. local function centerText(y, text, textColor)
  11. local x = math.floor((width - #text) / 2)
  12. term.setCursorPos(x, y)
  13. term.setTextColor(textColor)
  14. term.write(text)
  15. end
  16.  
  17. -- Helper function to draw a loading bar
  18. local function drawLoadingBar(y, percent)
  19. local barWidth = math.floor(width * 0.6) -- Loading bar is 60% of the screen width
  20. local barX = math.floor((width - barWidth) / 2)
  21.  
  22. term.setCursorPos(barX, y)
  23. term.write("[")
  24. for i = 1, barWidth - 2 do
  25. if i <= (barWidth - 2) * (percent / 100) then
  26. term.write("=")
  27. else
  28. term.write(" ")
  29. end
  30. end
  31. term.write("]")
  32. end
  33.  
  34. -- Define the dog ASCII art with white color and @ for eyes
  35. local dogArt = {
  36. " |\\_/| ",
  37. " | @ @ ",
  38. " | <> _ ",
  39. " | _/\\------____ ((| |))",
  40. " | `--' | ",
  41. " _____|_ ___| |___. ",
  42. "/_/_____/____/_______| "
  43. }
  44.  
  45. local startLine = math.floor((height - #dogArt) / 2) - 2
  46.  
  47. -- Display the dog ASCII art with white color
  48. term.setTextColor(colors.white)
  49. for i, line in ipairs(dogArt) do
  50. centerText(startLine + i, line, colors.white)
  51. end
  52.  
  53. -- Display the "Please Wait..." message in white
  54. centerText(startLine + #dogArt + 2, "Preparing Automatic Repair...", colors.white)
  55.  
  56. -- Wait for 4 seconds to simulate initialization
  57. sleep(4)
  58.  
  59. -- Clear the "Please Wait..." message
  60. term.clearLine()
  61. centerText(startLine + #dogArt + 2, "", colors.white)
  62.  
  63. -- Display the "Installation in Progress..." message in white
  64. centerText(startLine + #dogArt + 2, "Repairing Doggy OS Installation...", colors.white)
  65.  
  66. -- Simulate a loading bar for the installation process
  67. for i = 1, 100, 5 do
  68. drawLoadingBar(startLine + #dogArt + 4, i)
  69. sleep(0.75) -- Simulate installation process with each increment
  70. end
  71.  
  72. -- Clear the loading bar and "Installing Doggy OS..." message
  73. term.clearLine()
  74. centerText(startLine + #dogArt + 2, "", colors.white)
  75.  
  76. -- Execute the installation commands
  77. local function fullSystemRecovery()
  78. local function checkAndCopyMissingFiles()
  79. local function copyFileIfMissing(sourcePath, targetPath)
  80. if not fs.exists(targetPath) then
  81. fs.copy(sourcePath, targetPath)
  82. end
  83. end
  84.  
  85. local function checkDirectory(sourceDir, targetDir, excludeDir)
  86. local files = fs.list(sourceDir)
  87. for _, file in ipairs(files) do
  88. local sourcePath = fs.combine(sourceDir, file)
  89. local targetPath = fs.combine(targetDir, file)
  90.  
  91. if fs.isDir(sourcePath) then
  92. if not sourcePath:match(excludeDir) then
  93. checkDirectory(sourcePath, targetPath, excludeDir)
  94. end
  95. else
  96. copyFileIfMissing(sourcePath, targetPath)
  97. end
  98. end
  99. end
  100.  
  101. checkDirectory("/recovery", "/disk", "/disk/users")
  102. end
  103.  
  104. -- Perform the recovery process
  105. checkAndCopyMissingFiles()
  106. end
  107.  
  108. -- Display the "Installation Complete!" message in white
  109. centerText(startLine + #dogArt + 2, "Doggy OS System Recovery Complete!", colors.white)
  110.  
  111. -- Display the countdown message
  112. for i = 5, 0, -1 do
  113. centerText(startLine + #dogArt + 4, "Rebooting in " .. i .. "...", colors.white)
  114. sleep(1)
  115. end
  116.  
  117. -- Wait for 3 seconds before rebooting
  118. sleep(0.5)
  119.  
  120. -- Reboot the system
  121. os.reboot()
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement