Advertisement
jakikoske

mining test 2014 latest

Nov 22nd, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. local position = vector.new(gps.locate(0))
  2. local orientation
  3.  
  4. function getPosition()
  5.     position = vector.new(gps.locate(0))
  6.     position.x = position.x -1
  7. end
  8.  
  9. function getPositionOffset()
  10.     getPosition()
  11.     position.x = position.x%16
  12.     position.y = position.y%16
  13. end
  14.  
  15. function addOrientation(i)
  16.     orientation = orientation + i
  17.     if orientation == 4 then
  18.         orientation = 0
  19.     end
  20.     if orientation == -1 then
  21.         orientation = 3
  22.     end
  23. end
  24.  
  25. function turnRight()
  26.     turtle.turnRight()
  27.     addOrientation(1)
  28. end
  29.  
  30. function setOrientationX()
  31.     while orientation ~= 1 do
  32.         turnRight()
  33.     end
  34. end
  35.  
  36. function move()
  37.     while(turtle.forward() == false) do
  38.             turtle.dig()
  39.             turtle.suck()
  40.     end
  41. end
  42.  
  43. function goTo00()
  44.     getPositionOffset()
  45.     setOrientationX()
  46.     for i = 0, position.x do
  47.         move()
  48.     end
  49. end
  50.  
  51. goTo00()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement