Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- tx = tArgs[1]
- tx = tonumber(tx)
- ty = tArgs[2]
- ty = tonumber(ty)
- tz = tArgs[3]
- tz = tonumber(tz)
- --Go to target Z position
- if z < tz then
- shell.run("setFacing","0")
- while z < tz do
- if not turtle.detect() then --check if there is a block ahead
- shell.run("forward")
- else
- if not turtle.detectUp() then --if there is a block ahead, check if there is a block above
- shell.run("up")
- end
- end
- end
- else
- if z > tz then
- shell.run("setFacing","2")
- while z > tz do
- if not turtle.detect() then
- shell.run("forward")
- else
- if not turtle.detectUp() then
- shell.run("up")
- end
- end
- end
- end
- end
- if x > tx then
- shell.run("setFacing","1")
- while x > tx do
- if not turtle.detect() then
- shell.run("forward")
- else
- if not turtle.detectUp() then
- shell.run("up")
- end
- end
- end
- else
- if x < tx then
- shell.run("setFacing","3")
- while x < tx do
- if not turtle.detect() then
- shell.run("forward")
- else
- if not turtle.detectUp() then
- shell.run("up")
- end
- end
- end
- end
- end
- while y > ty do shell.run("down") end
- while y < ty do shell.run("up") end
Advertisement
Add Comment
Please, Sign In to add comment