Advertisement
kelm

Farm Tools - Fir

Nov 10th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. local args = { ... }
  2. local height = 0
  3. local sapling = 0
  4. local meal = 0
  5.  
  6. function suppliesLast()
  7.   sapling = 0
  8.   meal = 0
  9.   if turtle.getItemCount(1) > 3 then
  10.     sapling = 1
  11.   end
  12.   if turtle.getItemCount(2) > 0 then
  13.     meal = 2
  14.   end
  15.   return sapling >= 0 and meal >= 0
  16. end
  17.  
  18. function step()
  19.   while not turtle.forward() do
  20.     turtle.dig()
  21.   end
  22. end
  23.  
  24. function stepBack()
  25.   if not turtle.back() then
  26.     turtle.turnRight()
  27.     turtle.turnRight()
  28.     step()
  29.     turtle.turnRight()
  30.     turtle.turnRight()
  31.   end
  32. end
  33.  
  34. function stepUp()
  35.   while not turtle.up() do
  36.     turtle.digUp()
  37.   end
  38. end
  39.  
  40. function stepDown()
  41.   while not turtle.down() do
  42.     turtle.digDown()
  43.   end
  44. end
  45.  
  46. while suppliesLast() do
  47.   height = 0
  48.   turtle.select(sapling)
  49.   step()
  50.   step()
  51.   turtle.turnRight()
  52.   turtle.place()
  53.   turtle.turnLeft()
  54.   stepBack()
  55.   turtle.place()
  56.   turtle.turnRight()
  57.   turtle.place()
  58.   turtle.turnLeft()
  59.   turtle.stepBack()
  60.   turtle.place()
  61.   turtle.select(meal)
  62.   turtle.place()
  63.   while turtle.detect() do
  64.     turtle.dig()
  65.     step()
  66.     turtle.dig()
  67.     step()
  68.     turtle.turnRight()
  69.     turtle.dig()
  70.     turtle.turnLeft()
  71.     stepBack()
  72.     turtle.turnRight()
  73.     turtle.dig()
  74.     turtle.turnLeft()
  75.     stepBack()
  76.     stepUp()
  77.     height = height + 1
  78.   end
  79.   for i = 1, height, 1 do
  80.     stepDown()
  81.   end
  82.   turtle.turnRight()
  83.   turtle.turnRight()
  84.   for i = 3, 16, 1 do
  85.     turtle.select(i)
  86.     turtle.drop()
  87.   end
  88.   turtle.turnRight()
  89.   turtle.turnRight()
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement