Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local X, Y, Z, O
- local North, East, South, West = 0, 1, 2, 3
- function forward()
- while not turtle.forward() do
- while not turtle.dig() do
- GPSup()
- end
- end
- end
- function locate()
- X, Y2, Z = gps.locate()
- forward()
- X2, Y, Z2 = gps.locate()
- if X2>X then O = East end
- if X2<X then O = West end
- if Z2>Z then O = South end
- if Z2<Z then O = North end
- turtle.back()
- return X, Y, Z, O
- end
- function GPSforward()
- if O == East then X = X+1 end
- if O == West then X = X-1 end
- if O == North then Z = Z-1 end
- if O == South then Z = Z+1 end
- forward()
- end
- function GPSturn(Direction)
- while Direction~=O do
- turtle.turnRight()
- O = O + 1
- if O == 4 then O = 0 end
- end
- end
- function GPSup()
- while not turtle.up() do
- turtle.digUp()
- end
- Y = Y + 1
- end
- function GPSdown()
- while not turtle.down() do
- turtle.digDown()
- end
- Y = Y - 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement