mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-19 05:32:51 +00:00
Added autoupdater
This commit is contained in:
parent
ea50b6b7a7
commit
2bd56706e4
23
tron.lua
23
tron.lua
@ -130,9 +130,10 @@ local function interpretArgs(tInput, tArgs)
|
||||
end
|
||||
|
||||
local argData = {
|
||||
["skynet"] = false, -- use Skynet HTTP multiplayer
|
||||
["quick"] = false, -- start one game immediately
|
||||
["skynet"] = false, -- use Skynet HTTP multiplayer
|
||||
["quick"] = false, -- start one game immediately
|
||||
["griddemo"] = false, -- only move the grid
|
||||
["--update"] = false, -- updates TRON to the latest version
|
||||
["--gridID"] = "number" -- grid ID to use
|
||||
}
|
||||
|
||||
@ -235,6 +236,7 @@ local argList = interpretArgs({...}, argData)
|
||||
local useSkynet = argList["skynet"]
|
||||
local useOnce = argList["quick"]
|
||||
local doGridDemo = argList["griddemo"]
|
||||
local doUpdateGame = argList["--update"]
|
||||
if gridList[argList["--gridID"]] then
|
||||
gridID = argList["--gridID"]
|
||||
end
|
||||
@ -1590,6 +1592,23 @@ local main = function()
|
||||
end
|
||||
end
|
||||
|
||||
if doUpdateGame then
|
||||
print("Downloading...")
|
||||
local net = http.get("https://github.com/LDDestroier/CC/raw/master/tron.lua")
|
||||
if net then
|
||||
local file = fs.open(shell.getRunningProgram(), "w")
|
||||
file.write(net.readAll())
|
||||
file.close()
|
||||
print("Updated!")
|
||||
else
|
||||
printError("Couldn't update!")
|
||||
end
|
||||
if useOnce then
|
||||
return
|
||||
else
|
||||
sleep(0.2)
|
||||
end
|
||||
end
|
||||
if doGridDemo then
|
||||
parallel.waitForAny(function()
|
||||
local step, gsX, gsY = 0, 0, 0
|
||||
|
Loading…
Reference in New Issue
Block a user