Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local width, height = term.getSize()
- local function update(text)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 9)
- term.clearLine()
- term.setCursorPos(math.floor(width/2 - string.len(text)/2), 9)
- write(text)
- end
- local function bar(ratio)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.lime)
- term.setCursorPos(1, 11)
- for i = 1, width do
- if (i/width < ratio) then
- write("]")
- else
- write(" ")
- end
- end
- end
- local function download(downloadPath, savePath)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1, 13)
- term.clearLine()
- term.setCursorPos(1, 14)
- term.clearLine()
- term.setCursorPos(1, 15)
- term.clearLine()
- term.setCursorPos(1, 16)
- term.clearLine()
- term.setCursorPos(1, 17)
- term.clearLine()
- term.setCursorPos(1, 13)
- print("Accessing https://raw.githubusercontent.com/Xella37/Pine3D/master/"..downloadPath)
- local rawData = http.get("https://raw.githubusercontent.com/Xella37/Pine3D/master/"..downloadPath)
- local data = rawData.readAll()
- local file = fs.open(savePath, "w")
- file.write(data)
- file.close()
- end
- function install()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.yellow)
- term.clear()
- local str = "Pine3D Installer"
- term.setCursorPos(math.floor(width/2 - #str / 2), 2)
- write(str)
- update("Installing...")
- bar(0)
- update("Downloading Pine3D.lua...")
- download("Pine3D.lua", "Pine3D.lua")
- bar(0.2)
- update("Downloading betterblittle.lua...")
- download("betterblittle.lua", "betterblittle.lua")
- bar(0.4)
- update("Downloading Mountains.lua...")
- download("Mountains.lua", "Mountains.lua")
- bar(0.5)
- update("Downloading noise.lua...")
- download("noise.lua", "noise.lua")
- bar(0.6)
- update("Creating models folder...")
- fs.makeDir("models")
- bar(0.7)
- update("Downloading box model...")
- download("models/box", "models/box")
- bar(0.8)
- update("Downloading emerald model...")
- download("models/emerald", "models/emerald")
- bar(0.9)
- update("Downloading pineapple model...")
- download("models/pineapple", "models/pineapple")
- bar(1)
- update("Installation finished!")
- sleep(1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1, 1)
- write("Finished installation!\nPress any key to close...")
- os.pullEventRaw()
- term.clear()
- term.setCursorPos(1, 1)
- end
- install()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement