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)
- -- 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
- -- Helper function to draw a loading bar
- local function drawLoadingBar(y, percent)
- local barWidth = math.floor(width * 0.6) -- Loading bar is 60% of the screen width
- local barX = math.floor((width - barWidth) / 2)
- term.setCursorPos(barX, y)
- term.write("[")
- for i = 1, barWidth - 2 do
- if i <= (barWidth - 2) * (percent / 100) then
- term.write("=")
- else
- term.write(" ")
- end
- end
- term.write("]")
- end
- -- Define the dog ASCII art with white color and @ for eyes
- local dogArt = {
- " |\\_/| ",
- " | @ @ ",
- " | <> _ ",
- " | _/\\------____ ((| |))",
- " | `--' | ",
- " _____|_ ___| |___. ",
- "/_/_____/____/_______| "
- }
- local startLine = math.floor((height - #dogArt) / 2) - 2
- -- Display the dog ASCII art with white color
- term.setTextColor(colors.white)
- for i, line in ipairs(dogArt) do
- centerText(startLine + i, line, colors.white)
- end
- -- Display the "Please Wait..." message in white
- centerText(startLine + #dogArt + 2, "Preparing Automatic Repair...", colors.white)
- -- Wait for 4 seconds to simulate initialization
- sleep(4)
- -- Clear the "Please Wait..." message
- term.clearLine()
- centerText(startLine + #dogArt + 2, "", colors.white)
- -- Display the "Installation in Progress..." message in white
- centerText(startLine + #dogArt + 2, "Repairing Doggy OS Installation...", colors.white)
- -- Simulate a loading bar for the installation process
- for i = 1, 100, 5 do
- drawLoadingBar(startLine + #dogArt + 4, i)
- sleep(0.75) -- Simulate installation process with each increment
- end
- -- Clear the loading bar and "Installing Doggy OS..." message
- term.clearLine()
- centerText(startLine + #dogArt + 2, "", colors.white)
- -- Execute the installation commands
- local function fullSystemRecovery()
- local function checkAndCopyMissingFiles()
- local function copyFileIfMissing(sourcePath, targetPath)
- if not fs.exists(targetPath) then
- fs.copy(sourcePath, targetPath)
- end
- end
- local function checkDirectory(sourceDir, targetDir, excludeDir)
- local files = fs.list(sourceDir)
- for _, file in ipairs(files) do
- local sourcePath = fs.combine(sourceDir, file)
- local targetPath = fs.combine(targetDir, file)
- if fs.isDir(sourcePath) then
- if not sourcePath:match(excludeDir) then
- checkDirectory(sourcePath, targetPath, excludeDir)
- end
- else
- copyFileIfMissing(sourcePath, targetPath)
- end
- end
- end
- checkDirectory("/recovery", "/disk", "/disk/users")
- end
- -- Perform the recovery process
- checkAndCopyMissingFiles()
- end
- -- Display the "Installation Complete!" message in white
- centerText(startLine + #dogArt + 2, "Doggy OS System Recovery Complete!", colors.white)
- -- Display the countdown message
- for i = 5, 0, -1 do
- centerText(startLine + #dogArt + 4, "Rebooting in " .. i .. "...", colors.white)
- sleep(1)
- end
- -- Wait for 3 seconds before rebooting
- sleep(0.5)
- -- Reboot the system
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement