Advertisement
Hoolaf

turtleLib/move

Sep 4th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. os.loadAPI("turtleLib/fuel")
  2. os.loadAPI("turtleLib/nav")
  3. local total = 0
  4.  
  5. function w(x)
  6.  
  7.   for i = 1,x do
  8.     fuel.refuel(1)
  9.     local didMove = turtle.forward(1)
  10.     if didMove == true then
  11.      
  12.    
  13.     else
  14.      
  15.     end
  16.   end
  17. end
  18.  
  19. function a(x)
  20.  
  21.   turtle.turnLeft()
  22.   move.w(x)
  23.  
  24. end
  25.  
  26. function s(x)
  27.  
  28.   turtle.turnRight()
  29.   turtle.turnRight()
  30.   move.w(x)
  31.  
  32. end
  33.  
  34. function d(x)
  35.  
  36.   turtle.turnRight()
  37.   move.w(x)
  38.  
  39. end
  40.  
  41. function strafeLeft(x)
  42.  
  43.   if x == "" then
  44.     x = 1
  45.   end
  46.  
  47.   move.a(x)
  48.   turtle.turnRight()
  49.  
  50. end
  51.  
  52. function strafeRight(x)
  53.  
  54.   if x == "" then
  55.     x = 1
  56.   end
  57.  
  58.   move.d(x)
  59.   turtle.turnLeft()
  60.  
  61. end
  62.  
  63. function odometer()
  64.  
  65.   return total
  66.  
  67. end
  68.  
  69. function resetOdometer()
  70.  
  71.   total = 0
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement