Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if turtle.getFuelLevel() == 0 then
- print("No Fuel")
- error()
- elseif turtle.getFuelLevel() < 300 then
- print("Low Fuel")
- error()
- end
- if fs.exists("schemAPI") then
- fs.delete("schemAPI")
- end
- shell.run("pastebin get 13QunP89 schemAPI")
- function gpsSetup()
- if gps.locate() then
- gpsi = true
- origDir = calibrateDir()
- local h,k,l = gps.locate()
- local k = k + 1
- Hoff,Koff,Loff = h,k,l
- Hoff = math.floor(Hoff)
- Koff = math.floor(Koff)
- Loff = math.floor(Loff)
- else
- origDir = "south"
- end
- end
- function copySetupVars()
- local h = fs.open("reference",'w')
- h.writeLine("slots = {}")
- h.writeLine("filename = ".."\""..tostring(filename).."\"")
- for i,v in pairs(slots) do
- h.writeLine("slots\["..i.."\] = {}")
- for i2,v2 in pairs(v) do
- h.writeLine("slots\["..i.."\]\["..i2.."\] = {}")
- for i3,v3 in pairs(v2) do
- h.writeLine("slots\["..i.."\]\["..i2.."\]\["..i3.."\] = "..tostring(v3))
- end
- end
- end
- h.writeLine("invList = {}")
- for i,v in pairs(invList) do
- h.writeLine("invList\["..i.."\] = {}")
- for i2,v2 in pairs(v) do
- h.writeLine("invList\["..i.."\]\[".."\""..i2.."\"".."\] = "..tostring(v2))
- end
- end
- h.writeLine("height = "..tostring(height))
- h.writeLine("width = "..tostring(width))
- h.writeLine("length = "..tostring(length))
- h.writeLine("chestOrder = "..tostring(chestOrder))
- h.writeLine("enderchest1 = "..tostring(enderchest1))
- h.writeLine("enderchest2 = "..tostring(enderchest2))
- h.writeLine("origDir = ".."\""..tostring(origDir).."\"")
- h.writeLine("Hoff, Koff, Loff = "..tostring(Hoff)..", "..tostring(Koff)..", "..tostring(Loff))
- h.writeLine("blocks = {}")
- for i,v in pairs(blocks) do
- h.writeLine("blocks\["..i.."\] = "..tostring(v))
- end
- h.writeLine("data = {}")
- for i,v in pairs(data) do
- h.writeLine("data\["..i.."\] = "..tostring(v))
- end
- h.close()
- end
- if not fs.exists("reference") then
- if fs.exists("position") then
- fs.delete("position")
- end
- if fs.exists("objective") then
- fs.delete("objective")
- end
- shell.run("schemAPI")
- heightPos = -1
- widthPos = 0
- lengthPos = 0
- face = "south"
- x = 0
- y = 0
- z = 0
- enderchest1 = 15
- enderchest2 = 16
- chestOrder = 1
- blocks = {}
- data = {}
- openRednet()
- gpsSetup()
- tArgs = {...}
- if #tArgs ~= 1 then
- print("Usage: schemSetup <gunzipped schematic file>")
- return
- end
- filename = tArgs[1]
- if not fs.exists(filename) then
- print("File does not exist.")
- return
- end
- handle = fs.open(filename, "rb")
- setup()
- copySetupVars()
- end
- if tArgs then
- recordPos(-1,0,0,"south")
- recordObj(x,y,z)
- recordObjNum(1)
- else
- shell.run("reference")
- shell.run("position")
- shell.run("objective")
- end
- local h = fs.open("startup","w")
- h.write([[
- shell.run("reference")
- shell.run("schemAPI")
- openRednet()
- checkIfRefill()
- if gps.locate() then
- gpsi = true
- else
- gpsi = false
- end
- resynchronize()
- pcall(checkIfAir2(slots,height,width,length))
- autorun2()
- ]])
- h.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement