Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fs.exists("schemAPI") then
- fs.delete("schemAPI")
- end
- shell.run("pastebin get kpjMGqfq schemAPI")
- function gpsSetup()
- for _,v in ipairs(peripheral.getNames()) do
- if peripheral.getType(v)=="modem" then
- rednet.open(v)
- end
- end
- if gps.locate() then
- gpsi = true
- origDir = calibrateDir()
- local h,k,l = gps.locate()
- local k = k + 1
- Hoff,Koff,Loff = h,k,l
- 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 = {}
- 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 turtle.getFuelLevel() == 0 then
- print("No Fuel")
- error()
- elseif turtle.getFuelLevel() < 300 then
- print("Low Fuel")
- error()
- end
- function recordPos(heightPos,widthPos,lengthPos,face)
- local h = fs.open("position","w")
- h.writeLine("heightPos = "..tostring(heightPos))
- h.writeLine("widthPos = "..tostring(widthPos))
- h.writeLine("lengthPos = "..tostring(lengthPos))
- h.writeLine("face = ".."\""..tostring(face).."\"")
- h.close()
- end
- if tArgs then
- recordPos(-1,0,0,"south")
- recordObj(x,y,z)
- 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")
- checkIfRefill()
- --resynchronize()
- autorun()
- ]])
- h.close()
Add Comment
Please, Sign In to add comment