Advertisement
Himeki

Tree Farm

Jan 18th, 2013
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. function clear()
  2.     term.clear()
  3.     term.setCursorPos(1,1)
  4. end
  5.  
  6. clear()
  7.  
  8. function planter()
  9.   turtle.select(1)
  10.   n=0
  11.   while turtle.detectDown() and (turtle.getItemCount(1)>0) do
  12.     turtle.back()
  13.     turtle.place()
  14.     n=n+1
  15.   end
  16.   print("Planted " .. n .. " plants.")
  17.   n=0
  18. end
  19.  
  20. function lumberjack()
  21.   while not turtle.detect() do
  22.     turtle.forward()
  23.   end
  24.   turtle.dig()
  25.   print("Starting, turtle...")
  26.   turtle.forward()
  27.   while turtle.detectUp() do
  28.     turtle.digUp()
  29.     turtle.up()
  30.   end
  31.   while not turtle.detectUp() and not turtle.detectDown() do
  32.     turtle.down()
  33.   end
  34.   print ("Complete, Turtle.")
  35. end
  36.  
  37. print("Starting farm, turtle.")
  38. y=0
  39. while turtle.detect() do
  40.   print("Starting lumberjack, turtle.")
  41.   lumberjack()
  42.   y=y+1
  43. end
  44. print("Cut " .. y .. "trees, turtle.")
  45. print("Starting planter, turtle.")
  46. planter()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement