Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --gps addon
- --refill addon
- --iterator
- 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
- function recordObj(x,y,z)
- local h = fs.open("objective",'w')
- h.writeLine("x = "..tostring(x))
- h.writeLine("y = "..tostring(y))
- h.writeLine("z = "..tostring(z))
- h.close()
- end
- function findNextBlock(x,y,z)
- blockID = getBlockId(x,y,z)
- blockData = getData(x,y,z)
- if blockID then
- slot_lst = slots[blockID][blockData]
- if(slot_lst ~= nil) then
- if(#slot_lst > 0) then
- local found=false
- for i,v in ipairs(slot_lst) do
- if(turtle.getItemCount(v) > 0) then
- found=true
- turtle.select(v)
- break
- end
- end
- if not found then
- print("Not enough " .. getBlockName(blockID, blockData) .. ". Please refill...")
- refill()
- end
- while turtle.getItemCount() == 0 do
- refill()
- end
- local doubleCheck = turtle.getItemDetail()
- if doubleCheck.name ~= "EnderStorage:enderChest" then
- place()
- else
- findNextBlock(x,y,z)
- end
- end
- if turtle.getFuelLevel() < 200 then
- refill()
- end
- end
- end
- end
- function autorun()
- --get the current coords
- --get the iterater/goal block location
- while true do
- shell.run("position")
- shell.run("objective")
- goto(x,y,z)
- findNextBlock(x,y,z)
- checkIfAir()
- end
- shell.run("clr")
- print("finished")
- end
Add Comment
Please, Sign In to add comment