mirror of
https://github.com/LDDestroier/CC/
synced 2025-01-31 11:19:11 +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
|
end
|
||||||
|
|
||||||
local argData = {
|
local argData = {
|
||||||
["skynet"] = false, -- use Skynet HTTP multiplayer
|
["skynet"] = false, -- use Skynet HTTP multiplayer
|
||||||
["quick"] = false, -- start one game immediately
|
["quick"] = false, -- start one game immediately
|
||||||
["griddemo"] = false, -- only move the grid
|
["griddemo"] = false, -- only move the grid
|
||||||
|
["--update"] = false, -- updates TRON to the latest version
|
||||||
["--gridID"] = "number" -- grid ID to use
|
["--gridID"] = "number" -- grid ID to use
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +236,7 @@ local argList = interpretArgs({...}, argData)
|
|||||||
local useSkynet = argList["skynet"]
|
local useSkynet = argList["skynet"]
|
||||||
local useOnce = argList["quick"]
|
local useOnce = argList["quick"]
|
||||||
local doGridDemo = argList["griddemo"]
|
local doGridDemo = argList["griddemo"]
|
||||||
|
local doUpdateGame = argList["--update"]
|
||||||
if gridList[argList["--gridID"]] then
|
if gridList[argList["--gridID"]] then
|
||||||
gridID = argList["--gridID"]
|
gridID = argList["--gridID"]
|
||||||
end
|
end
|
||||||
@ -1590,6 +1592,23 @@ local main = function()
|
|||||||
end
|
end
|
||||||
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
|
if doGridDemo then
|
||||||
parallel.waitForAny(function()
|
parallel.waitForAny(function()
|
||||||
local step, gsX, gsY = 0, 0, 0
|
local step, gsX, gsY = 0, 0, 0
|
||||||
|
Loading…
Reference in New Issue
Block a user