Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local scanner = peripheral.find("geoscanner")
- local fuel = turtle.getFuelLevel()
- print("What block to mine?")
- local search = io.read()
- local direction = 0
- local offset = {0, 0, 0}
- function turnRight()
- turtle.turnRight()
- direction += 1
- if direction > 3 then
- direction = 0
- end
- end
- function turnLeft()
- turtle.turnLeft()
- direction += 1
- if direction < 0 then
- direction = 3
- end
- end
- function moveX(distance)
- if distance > 0 then
- if direction == 0 then
- turnRight()
- elseif direction == 3 then
- turnRight()
- turnRight()
- if direction == 2 then
- turnLeft()
- end
- else
- if direction == 0 then
- turnLeft()
- elseif direction == 2 then
- turnRight()
- if direction == 1 then
- turnRight()
- turnRight()
- end
- end
- for a = 1, distance do
- turtle.dig()
- turtle.forward()
- offset = {offset[x]+(math.abs(distance)/distance), offset[y], offset[z]}
- end
- end
- function moveZ(distance)
- if distance > 0 then
- if direction == 1 then
- turnRight()
- elseif direction == 3 then
- turnLeft()
- if direction == 0 then
- turnRight()
- turnRight()
- end
- else
- if direction == 2 then
- turnRight()
- elseif direction == 0 then
- turnLeft()
- if direction == 1 then
- turnRight()
- turnRight()
- end
- end
- for a = 1, distance do
- turtle.dig()
- turtle.forward()
- offset = {offset[x], offset[y], offset[z]+(math.abs(distance)/distance)}
- end
- end
- function moveY(distance)
- if distance > 0 then
- turtle.digUp()
- turtle.up()
- {offset[x], offset[y]+1, offset[z]}
- else
- turtle.digDown()
- turtle.down()
- {offset[x], offset[y]-1, offset[z]}
- end
- end
- function Move(vector)
- moveX(vector[1])
- moveY(vector[2])
- moveZ(vector[3])
- end
- Move(1, 1, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement