Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local turbinePastebinID = "878A8fVm"
- local reactorPastebinID = "MMb8tZZ6"
- local type = 0
- local function choise()
- term.setTextColor(colors.yellow)
- print("Which program do you want to install?")
- print("1. Turbine")
- print("2. Reactor")
- while true do
- term.setTextColor(colors.white)
- local input = read()
- if input == "1" then break end
- if input == "2" then break end
- end
- type = tonumber(input)
- print("")
- end
- local function update(id)
- term.setTextColor(colors.blue)
- print("Downloading files...")
- shell.run("pastebin", "get", id, "dl")
- local succes = shell.run("rename", "dl", "checked")
- if succes == false then
- term.setTextColor(colors.red)
- print("\nFailed to download file!")
- else
- term.setTextColor(colors.green)
- print("\nDownload succes!\n")
- term.setTextColor(colors.blue)
- print("Removing old files...")
- shell.run("rm","startup")
- term.setTextColor(colors.blue)
- print("Renaming new files...\n")
- shell.run("rename","checked","startup")
- term.setTextColor(colors.green)
- print("Update succes!")
- while true do
- term.setTextColor(colors.yellow)
- print("Do you want to reboot now? (y/n)")
- term.setTextColor(colors.white)
- local input = read()
- if input == "y" then shell.run("reboot")
- elseif input == "n" then break end
- end
- end
- end
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- local turbines = peripheral.find("BigReactors-Turbine")
- local reactor = peripheral.find("BigReactors-Reactor")
- if turbines ~= nil then
- type = 2
- end
- if reactor ~= nil then
- type = type + 1
- end
- term.setTextColor(colors.blue)
- print("Auto detect peripheral...\n")
- if type ~= 3 then
- term.setTextColor(colors.green)
- while true do
- term.setTextColor(colors.yellow)
- if type == 1 then
- print("Reactor detected, confirm instalation? (y/n)")
- elseif type == 2 then
- print("Turbine detected, confirm instalation? (y/n)")
- else
- term.setTextColor(colors.red)
- print("No peripheral found!\n")
- choise()
- break
- end
- term.setTextColor(colors.white)
- local input = read()
- if input == "y" or input == "n"then break end
- end
- if input == "n" then
- choise()
- end
- else
- term.setTextColor(colors.red)
- print("Turbine AND Reactor detected!")
- choise()
- end
- if type == 1 then
- update(reactorPastebinID)
- else
- update(turbinePastebinID)
- end
Advertisement
Add Comment
Please, Sign In to add comment