Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- local i = turtle.getFuelLevel()
- if (i < 200) and (i < 1000) then
- turtle.refuel(1)
- end
- turtle.forward()
- turtle.turnLeft()
- for j = 1, 100 do
- if turtle.detectDown() then
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- j = j + 1
- else
- turtle.forward()
- j = j + 1
- end
- else
- turtle.down()
- end
- end
- for k = 1, 50 do
- if turtle.detectDown() then
- turtle.dig()
- turtle.digDown()
- turtle.down()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- k = k + 1
- else
- turtle.down()
- turtle.dig()
- turtle.digDown()
- turtle.down()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- k = k + 1
- end
- end
- local x, y, z = gps.locate()
- yDif = y + 1
- zDif = z - 252.62
- xDif = x + 3.94
- if yDif < 0 then
- if turtle.detectUp() then
- turtle.digUp()
- turtle.up()
- else
- turtle.up()
- end
- end
- if yDif > 0 then
- if turtle.detectDown() then
- turtle.digDown()
- turtle.down()
- else
- turtle.down()
- end
- end
- local xx, yy, zz = gps.locate();
- xDif2 = xx - x
- zDif2 = zz - z
- if xDif2 > 0 then
- if zDif < 0 then
- turtle.turnLeft()
- while zDif < 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif - zDif2
- else
- turtle.forward()
- zDif = zDif - zDif2
- end
- end
- end
- if zDif > 0 then
- turtle.turnRight()
- while zDif > 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif + zDif2
- else
- turtle.forward()
- zDif = zDif + zDif2
- end
- end
- end
- end
- if xDif2 < 0 then
- if zDif < 0 then
- turtle.turnRight()
- while zDif < 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif - zDif2
- else
- turtle.forward()
- zDif = zDif - zDif2
- end
- end
- end
- if zDif > 0 then
- turtle.turnLeft()
- while zDif > 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif + zDif2
- else
- turtle.forward()
- zDif = zDif + zDif2
- end
- end
- end
- end
- if zDif2 > 0 then
- if zDif < 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- while zDif < 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif + zDif2
- else
- turtle.forward()
- zDif = zDif + zDif2
- end
- end
- end
- if zDif > 0 then
- while zDif > 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif - zDif2
- else
- turtle.forward()
- zDif = zDif - zDif2
- end
- end
- end
- end
- if zDif2 < 0 then
- if zDif < 0 then
- while zDif < 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif - zDif2
- else
- turtle.forward()
- zDif = zDif - zDif2
- end
- end
- end
- if zDif > 0 then
- while zDif > 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- zDif = zDif + zDif2
- else
- turtle.forward()
- zDif = zDif + zDif2
- end
- end
- end
- end
- turtle.turnLeft()
- local x3, y3, z3 = gps.locate()
- turtle.forward()
- local x4, y4, z4 = gps.locate()
- xDif3 = x4 - x3
- if xDif3 < 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- while xDif3 < 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- xDif3 = xDif3 - xDif3
- else
- turtle.forward()
- xDif3 = xDif3 - xDif3
- end
- end
- end
- if xDif3 > 0 then
- turtle.turnLeft()
- turtle.turnLeft()
- while xDif3 > 0 do
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- xDif3 = xDif3 - xDif3
- else
- turtle.forward()
- xDif3 = xDif3 - xDif3
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement