dealingwith

Tree Farm Collector

Jan 18th, 2015
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- collector for the tree farm
  2. -- place facing away from the tree farm
  3. -- ten blocks from the center of the tree farm
  4. -- place fuel blocks in the last slot (16)
  5. -- place chest to the right of the turtle
  6. --   (as it is facing away)
  7.  
  8. function fuel()
  9.   if turtle.getFuelLevel() < 30 then
  10.     turtle.select(16)
  11.     if turtle.refuel(16) then
  12.       return true
  13.     end
  14.     print("Refuelling failed.")
  15.     return false
  16.   end
  17. end
  18.  
  19. function tunnel()
  20.   for i=1,10,1 do
  21.     turtle.dig()
  22.     turtle.forward()
  23.   end
  24.   for i=1,3,1 do
  25.     turtle.digUp()
  26.     turtle.up()
  27.   end
  28. end
  29.  
  30. function reverseTunnel()
  31.   for i=1,3,1 do
  32.     turtle.digDown()
  33.     turtle.down()
  34.   end
  35.   for i=1,10,1 do
  36.     turtle.dig()
  37.     turtle.forward()
  38.   end
  39. end
  40.  
  41. function dump()
  42.   turtle.turnRight()
  43.   for i=1,15,1 do
  44.     turtle.select(i)
  45.     turtle.drop()
  46.   end
  47. end
  48.  
  49. function collect()
  50.   print("Fueling")
  51.   fuel()
  52.   print("Going back for more")
  53.   reverseTunnel()
  54.   turtle.select(1)
  55.   print("Picking up stuff")
  56.   sucked = true
  57.   while sucked == true do
  58.     sucked = turtle.suck()
  59.   end
  60.   turtle.turnRight()
  61.   turtle.turnRight()
  62.   print("Coming back")
  63.   tunnel()
  64.   print("Dumping")
  65.   dump()
  66.   turtle.turnRight()
  67. end
  68.  
  69. while true do
  70.   collect()
  71.   print("Waiting 15 minutes")
  72.   os.sleep(900)
  73. end
Advertisement
Add Comment
Please, Sign In to add comment