Fill in outline of autocraft stuff

This commit is contained in:
2018-04-29 20:55:16 +01:00
parent b9faa51406
commit ea41e3574f
5 changed files with 87 additions and 8 deletions
+10 -6
View File
@@ -1,19 +1,23 @@
local argv = {...}
local root = "https://osmarks.ml/git/osmarks/dragon/raw/branch/master/"
local function download(name, file)
local contents = http.get(root .. name).readAll()
local function download(url, file)
local contents = http.get(url).readAll()
local f = fs.open(file, "w")
f.write(contents)
f.close()
end
local files = { "client.lua", "server.lua", "util.lua", "setup.lua" }
local files = { "client.lua", "server.lua", "util.lua", "setup.lua", "crafter.lua", "patterns.lua" }
for _, f in pairs(files) do
download(f, f)
download(root .. f, f)
print("Downloaded", f)
end
-- Download functional Lua library
download("https://github.com/Yonaba/Moses/blob/master/moses_min.lua", "moses.lua")
print "Downloaded Moses library"
print "Files downloaded. Either client.lua or server.lua should be run on startup."
if argv[1] == "update" then os.reboot() end
@@ -24,9 +28,9 @@ pcall(fs.move, "conf.lua", "conf") -- edit is really stupid, so un-.lua output f
local ty
repeat
print "Would you like this node set up as a server or client?"
print "Would you like this node set up as a server, crafter or client?"
ty = read()
until ty == "server" or ty == "client"
until ty == "server" or ty == "client" or ty == "crafter"
local f = fs.open("startup", "w")
f.write("shell.run '" .. ty .. "'")