Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- endLoop = true
- while endLoop == true do
- local i = turtle.getFuelLevel()
- if i < 200 then
- turtle.refuel(2)
- end
- turtle.forward()
- turtle.turnLeft()
- for j = 1, 50 do
- if turtle.detectDown() then
- if turtle.detect() then
- turtle.dig()
- turtle.forward()
- else
- turtle.forward()
- 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()
- else
- turtle.down()
- turtle.dig()
- turtle.digDown()
- turtle.down()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- local x, z, y = gps.locate()
- yDif = y
- zDif = z - 1
- xDif = x + 4
- print(yDif)
- while yDif < 0 do
- if turtle.detectUp() the
- turtle.digUp()
- turtle.up()
- else
- turtle.up()
- end
- end
- while yDif > 0 do
- if turtle.detectDown() then
- turtle.digDown()
- turtle.down()
- else
- turtle.down()
- end
- end
- local xx, zz, yy = 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, z3, y3 = gps.locate()
- turtle.forward()
- local x4, z4, y4 = 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
- local x5, z5, y5 = gps.locate()
- if (x5 == -4) and (y5 == 0) and (z5 == 1) then
- endLoop = false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement