Advertisement
ksaw000

getOrientation

Feb 3rd, 2021 (edited)
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. require("programs/globalVars")
  2.  
  3. loc1 = vector.new(gps.locate(2, false))
  4. if not turtle.forward() then
  5. for j=1,6 do
  6. if not turtle.forward() then
  7. turtle.dig()
  8. else
  9. break
  10. end
  11. end
  12. end
  13. loc2 = vector.new(gps.locate(2, false))
  14. local heading = loc2 - loc1
  15. return ((heading.x + math.abs(heading.x) * 2) + (heading.z + math.abs(heading.z) * 3))-1
  16.  
  17. --[[orientation will be:
  18. -x = 0 (WEST)
  19. -z = 1 (NORTH)
  20. +x = 2 (EAST)
  21. +z = 3 (SOUTH)
  22. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement