download.lua
63 lines · 1.8 KB
Install stairs system
Copy & run
wget https://perlytiara.github.io/turtles.tips/raw/programs/perlytiara/stairs/download.lua
| 1 | -- download.lua - Install stairs system |
| 2 | print("Installing stairs system...") |
| 3 | |
| 4 | local files = { |
| 5 | stairs = "https://raw.githubusercontent.com/perlytiara/CC-Tweaked-TurtsAndComputers/refs/heads/main/programs/perlytiara/stairs/stairs.lua", |
| 6 | client = "https://raw.githubusercontent.com/perlytiara/CC-Tweaked-TurtsAndComputers/refs/heads/main/programs/perlytiara/stairs/client.lua", |
| 7 | multi = "https://raw.githubusercontent.com/perlytiara/CC-Tweaked-TurtsAndComputers/refs/heads/main/programs/perlytiara/stairs/multi.lua", |
| 8 | startup = "https://raw.githubusercontent.com/perlytiara/CC-Tweaked-TurtsAndComputers/refs/heads/main/programs/perlytiara/stairs/startup.lua" |
| 9 | } |
| 10 | |
| 11 | -- Download file using wget |
| 12 | local function downloadFile(url, filename) |
| 13 | print("Downloading " .. filename .. "...") |
| 14 | local result = shell.run("wget", url, filename) |
| 15 | if result then |
| 16 | print("✓ " .. filename) |
| 17 | return true |
| 18 | else |
| 19 | print("✗ Failed to download " .. filename) |
| 20 | return false |
| 21 | end |
| 22 | end |
| 23 | |
| 24 | -- Create programs directory if it doesn't exist |
| 25 | if not fs.exists("programs") then |
| 26 | fs.makeDir("programs") |
| 27 | end |
| 28 | |
| 29 | -- Download files to programs directory |
| 30 | local success = 0 |
| 31 | |
| 32 | if downloadFile(files.stairs, "programs/stairs") then |
| 33 | success = success + 1 |
| 34 | end |
| 35 | |
| 36 | if downloadFile(files.client, "programs/client") then |
| 37 | success = success + 1 |
| 38 | end |
| 39 | |
| 40 | if downloadFile(files.multi, "programs/multi") then |
| 41 | success = success + 1 |
| 42 | end |
| 43 | |
| 44 | -- Setup startup file for turtles |
| 45 | if turtle then |
| 46 | if downloadFile(files.startup, "startup") then |
| 47 | success = success + 1 |
| 48 | end |
| 49 | else |
| 50 | print("- startup (not a turtle)") |
| 51 | end |
| 52 | |
| 53 | print("Installed " .. success .. " files") |
| 54 | |
| 55 | if turtle then |
| 56 | print("Turtle setup complete!") |
| 57 | print("Run 'client' to start listening for jobs") |
| 58 | print("Or run 'stairs <height> [up/down] [steps] [place]' directly") |
| 59 | else |
| 60 | print("Computer setup complete!") |
| 61 | print("Run 'multi' to send jobs to turtles") |
| 62 | end |
| 63 |