emagiannu

Apple Oak Farm

Dec 13th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function goUp()
  2.   if not turtle.up() then
  3.     turtle.digUp()
  4.     goUp()
  5.   end
  6. end
  7.  
  8. function reset()
  9.   turtle.select(16)
  10.   if not turtle.compareDown() then
  11.     print("Going Down")
  12.     turtle.down()
  13.     reset()
  14.   end
  15.   sleep(0.5)
  16. end
  17.  
  18. function chop()
  19.   dug = false
  20.   turtle.select(2)
  21.   reset()
  22.   turtle.select(15)
  23.   if turtle.compare() then
  24.     print("Waiting for apple to show up")
  25.     sleep(60)
  26.   end
  27.   while turtle.compare() do
  28.     print("Digging")
  29.     turtle.select(2)
  30.     turtle.dig()
  31.     goUp()
  32.     turtle.select(2)
  33.     dug = true
  34.   end
  35.   reset()
  36.   if dug then
  37.     drop()
  38.   end
  39. end
  40.  
  41. function plant()
  42.   turtle.select(1)
  43.   if not turtle.detect() then
  44.     print("Planting")
  45.     turtle.place()
  46.   end
  47. end
  48.  
  49. function drop()
  50.   reset()
  51.   --goUp()
  52.   for i=2, 14 do
  53.     turtle.select(i)
  54.     if turtle.getFuelLevel() < 100 then
  55.       print("Fuel level: " .. turtle.getFuelLevel() .. " Burning Wood.")
  56.       turtle.refuel()
  57.     end
  58.     turtle.drop()
  59.   end
  60. end
  61.  
  62. while true do
  63.   reset()
  64.   plant()
  65.   chop()
  66.   sleep(1)
  67. end
Advertisement
Add Comment
Please, Sign In to add comment