Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- write("What length should the hole be? ")
- local lengthTXT = read()
- local length = tonumber(lengthTXT)
- write("What width should the hole be? ")
- local widthTXT = read()
- local width = tonumber(widthTXT)
- write("What depth should the hole be? ")
- local depthTXT = read()
- local depth = tonumber(depthTXT)
- write("Digging a "..lengthTXT.."x"..widthTXT.."x"..depthTXT.." hole")
- local doLenFlip = 0
- local doWidFlip = 0
- local doDepFlip = 0
- if turtle.getFuelLevel() == 0 then
- turtle.refuel(1)
- end
- local x = 0
- local y = 0
- local z = 0
- for i = 1, depth do
- for j = 1, width do
- for k = 1, length-1 do
- if turtle.getFuelLevel() == 0 then
- turtle.refuel(1)
- end
- turtle.dig()
- repeat
- turtle.dig()
- until turtle.forward()
- if doLenFlip == 0 then
- x = x + 1
- else
- x = x - 1
- end
- local xtxt = tostring(x)
- local ytxt = tostring(y)
- local ztxt = tostring(z)
- print(xtxt, ytxt, ztxt)
- end
- if turtle.getFuelLevel() == 0 then
- turtle.refuel(1)
- end
- if j ~= width then
- if doLenFlip == 0 then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- doLenFlip = 1
- else
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- doLenFlip = 0
- end
- if doWidFlip == 0 then
- z = z + 1
- else
- z = z - 1
- end
- end
- end
- if i ~= depth then
- if turtle.getFuelLevel() == 0 then
- turtle.refuel(1)
- end
- turtle.digDown()
- turtle.down()
- turtle.turnRight()
- turtle.turnRight()
- if doWidFlip == 0 then
- doWidFlip = 1
- else
- doWidFlip = 0
- end
- y = y + 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement