Advertisement
ninja_axiom

HarvestTrees 5X4

Jul 22nd, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.34 KB | None | 0 0
  1. function cutTree()
  2.     height=0
  3.     turtle.dig()
  4.     turtle.forward()
  5.     while turtle.detectUp() do
  6.         turtle.digUp()
  7.         turtle.up()
  8.         height = height+1
  9.     end
  10.     for i=1, height do
  11.         turtle.down()
  12.     end
  13. end
  14.  
  15. function shiftLeft()
  16.     turtle.forward()
  17.     turtle.turnLeft()
  18.     for i=1, 6 do
  19.         turtle.forward()
  20.     end
  21.     turtle.turnLeft()
  22. end
  23.  
  24. function shiftRight()
  25.     turtle.forward()
  26.     turtle.turnRight()
  27.     for i=1, 6 do
  28.         turtle.forward()
  29.     end
  30.     turtle.turnRight()
  31. end
  32.  
  33. function returnHome()
  34.     for i=1, 5 do
  35.         turtle.forward()
  36.     end
  37.     turtle.turnLeft()
  38.     for i=1, 18 do
  39.         turtle.forward()
  40.     end
  41.     turtle.turnLeft()
  42. end
  43.  
  44. function dropGoods()
  45.     turtle.turnRight()
  46.     turtle.turnRight()
  47.     for i=1, 14 do
  48.         turtle.select(i)
  49.         turtle.drop()
  50.     end
  51.     turtle.turnRight()
  52.     turtle.turnRight()
  53. end
  54.  
  55. --Main
  56.  
  57. for i=1, 4 do   --Staring position
  58.     turtle.forward()
  59. end
  60.  
  61.  
  62. for i=1, 4 do --row 1
  63.     cutTree()
  64.     for j=1, 5 do
  65.         turtle.forward()
  66.     end
  67. end
  68. cutTree()
  69. shiftLeft()
  70.  
  71. for i=1, 4 do   --row 2
  72.     cutTree()
  73.     for j=1, 5 do
  74.         turtle.forward()
  75.     end
  76. end
  77. cutTree()
  78. shiftRight()
  79.  
  80. for i=1, 4 do --row 3
  81.     cutTree()
  82.     for j=1, 5 do
  83.         turtle.forward()
  84.     end
  85. end
  86. cutTree()
  87. shiftLeft()
  88.  
  89. for i=1, 4 do   --row 4
  90.     cutTree()
  91.     for j=1, 5 do
  92.         turtle.forward()
  93.     end
  94. end
  95. cutTree()
  96.  
  97.  
  98.  
  99.  
  100. returnHome()    --Return to Starting Position
  101. dropGoods()     --Place items in Chest
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement