Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function goto(xx,zz)
- x = tonumber(xx)
- z = tonumber(zz)
- rednet.open("left")
- cx, cy, cz = gps.locate()
- function getDirecX()
- if x > cx then
- dirX = 1
- else
- dirX = 3
- end
- end
- function getDirecZ()
- if cz > z then
- dirZ = 0
- else
- dirZ = 2
- end
- end
- function calx()
- for i = 1, dirX do
- turtle.turnRight()
- end
- end
- function calz()
- for p = 1,dirZ do
- turtle.turnRight()
- end
- end
- function uncalx()
- for k = 1, dirX do
- turtle.turnLeft()
- end
- end
- function uncalz()
- for o = 1, dirZ do
- turtle.turnLeft()
- end
- end
- function goZ()
- getDirecZ()
- calz()
- distzz = cz - z
- distz = math.abs(distzz)
- for p = 1, distz do
- turtle.forward()
- end
- uncalz()
- end
- function goX()
- getDirecX()
- calx()
- distxx = cx - x
- distx = math.abs(distxx)
- for q = 1, distx do
- turtle.dig()
- turtle.forward()
- end
- uncalx()
- end
- goZ()
- goX()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement