Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("advTurtle")
- advTurtle.override()
- safeFuel=500
- blocksMined=0;
- local function incBM()
- blocksMined=blocksMined+1
- end
- function doDig(num)
- for e=1, num do
- if turtle.dig() then incBM() end
- doForw(1)
- if turtle.digUp() then incBM() end
- if turtle.digDown() then incBM() end
- end
- end
- local function writeInfo()
- term.setCursorPos(1,1)
- local ta=advTurtle.localPos()
- if ta[4]==1 then facing="+x"
- elseif ta[4]==-1 then facing="-x"
- elseif ta[5]==1 then facing="+z"
- elseif ta[5]==-1 then facing="-z" end
- write(lpad("local x:"..ta[1].." y:"..ta[2].." z:"..ta[3],_x))
- write(lpad("facing local "..facing,_x))
- term.setCursorPos(1,4)
- fL=turtle.getFuelLevel()
- write(lpad("Fuel level: "..fL,_x))
- if fL<safeFuel then
- status="Refueling"
- for y=1, 16 do
- turtle.select(y)
- if turtle.refuel(5) then break end
- end
- else
- status="Mining"
- end
- term.setCursorPos(1,5)
- write(lpad("Blocks Mined: "..blocksMined,_x))
- term.setCursorPos(1,_y)
- write(lpad("Status: "..status,_x))
- end
- function doForw(num)
- for e=1, num do
- while not turtle.forward() do
- if turtle.dig() then incBM() end
- turtle.attack()
- end
- writeInfo()
- end
- end
- _x,_y=term.getSize()
- function lpad(str, leng, charg)
- if charg == nil then charg = ' ' end
- return str .. string.rep(charg, leng - #str)
- end
- term.clear()
- m = 0
- while true do
- for y=1, m do
- turtle.forward()
- end
- doDig(1)
- turtle.turnLeft()
- doDig(60)
- turtle.turnLeft()
- turtle.turnLeft()
- doDig(121)
- turtle.turnLeft()
- turtle.turnLeft()
- doDig(61)
- turtle.turnLeft()
- doForw(m+1)
- for y=1, 16 do
- turtle.select(y)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- m = m + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement