Lefra

Turtle tree mining

Jul 23rd, 2015
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. local i = 0
  2. local howManyTimes
  3.  
  4. function demiTour()
  5.   turtle.turnRight()
  6.   turtle.turnRight()
  7. end
  8.  
  9. function placeSapling()
  10.   term.clear()
  11.   term.setCursorPos(1,1)
  12.   print "Placing saplings..."
  13.   turtle.select(1)
  14.   turtle.place()
  15. end
  16.  
  17. function boneMeal()
  18.   term.clear()
  19.   term.setCursorPos(1,1)
  20.   print "Bonemealing..."
  21.   turtle.select(3)
  22.   while not turtle.compare() do
  23.     turtle.select(2)
  24.     turtle.place()
  25.     turtle.select(3)
  26.   end
  27. end
  28.  
  29. function cutTree()
  30.   term.clear()
  31.   term.setCursorPos(1,1)
  32.   print "Cutting tree..."
  33.   turtle.select(3)
  34.   if turtle.compare() then
  35.     turtle.dig()
  36.     turtle.forward()
  37.   end
  38.   while turtle.compareUp() do
  39.     turtle.digUp()
  40.     turtle.up()
  41.   end
  42.   while not turtle.detectDown() do
  43.     turtle.down()
  44.   end
  45.   demiTour()
  46. end
  47.  
  48. term.clear()
  49. term.setCursorPos(1,1)
  50. print "How many trees do you want to cut?"
  51. howManyTimes = io.read()
  52. howManyTimes = tonumber(howManyTimes)
  53. while (i < howManyTimes) do
  54. term.clear()
  55. term.setCursorPos(1,1)
  56. print "Getting items..."
  57. turtle.select(1)
  58. turtle.suck()
  59. turtle.turnRight()
  60. turtle.forward()
  61. turtle.forward()
  62. turtle.turnLeft()
  63. turtle.select(2)
  64. turtle.suck()
  65. turtle.turnRight()
  66. turtle.forward()
  67. turtle.forward()
  68. placeSapling()
  69. boneMeal()
  70. cutTree()
  71. for m=1,5,1 do
  72.   turtle.forward()
  73. end
  74. turtle.turnRight()
  75. i = i + 1
  76. end
Advertisement
Add Comment
Please, Sign In to add comment