Advertisement
DustinRosebery

treeFarm 1.1.2

Nov 3rd, 2013
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local t = turtle
  2.  
  3. local function forward(x)
  4.     for i = 1, x do
  5.         t.forward()
  6.     end
  7. end
  8.  
  9. local function rTurn(x)
  10.     for i = 1, x do
  11.         t.turnRight()
  12.     end
  13. end
  14.  
  15. local function lTurn(x)
  16.     for i = 1, x do
  17.         t.turnLeft()
  18.     end
  19. end
  20.  
  21. local function up(x)
  22.     for i = 1, x do
  23.         t.up()
  24.     end
  25. end
  26.  
  27. local function down(x)
  28.     for i = 1, x do
  29.         t.down()
  30.     end
  31. end
  32.  
  33. local function back(x)
  34.     for i = 1, x do
  35.         t.back()
  36.     end
  37. end
  38.  
  39. local fuelAmount = t.getFuelLevel()
  40.  
  41. local function fuelCheck()
  42.     if fuelAmount < 5000 then
  43.         back(3)
  44.         os.sleep(5)
  45.         rs.setOutput("left", true)
  46.         os.sleep(5)
  47.         rs.setOutput("left", false)
  48.         t.select(3)
  49.         t.refuel(all)
  50.         forward(3)
  51.         --t.print("Gassed up and good to go!")
  52.     else
  53.         t.print("Still Rollin!")--
  54.     end
  55. end
  56.  
  57. local itemCheck1 = t.getItemCount(1)
  58. local itemCheck2 = t.getItemCount(2)
  59.  
  60. local function bonemealCheck()
  61.     t.select(2)
  62.     if itemCheck2 < 10 then
  63.         back(3)
  64.         rs.setOutput("back", true)
  65.         os.sleep(15)
  66.         rs.setOutput("back", false)
  67.         forward(3)
  68.     else
  69.         --os.print("Ready to Bone")--
  70.     end
  71. end
  72.  
  73. local function saplingCheck()
  74.     t.select(1)
  75.     if itemCheck1 < 5 then
  76.         back(3)
  77.         rs.setOutput("right", true)
  78.         os.sleep(5)
  79.         rs.setOutput("right", false)
  80.         forward(3)
  81.     else
  82.         --os.print("It's time to Lay")--
  83.     end
  84. end
  85.  
  86. local function readyCheck()
  87.     saplingCheck()
  88.     bonemealCheck()
  89.     fuelCheck()
  90. end
  91.  
  92. local function grow()
  93.     t.select(2)
  94.     while t.place() do
  95.         t.place()
  96.     end
  97. end
  98.    
  99.  
  100. local function plant()
  101.     t.select(1)
  102.     t.place()
  103. end
  104.  
  105. local function harvest()
  106.     t.dig()
  107.     for i = 1, 15, 1 do
  108.         t.digUp()
  109.         up(1)
  110.     end
  111.     down(15)
  112.     back(1)
  113. end
  114.  
  115. while true do
  116.     readyCheck()
  117.     plant()
  118.     grow()
  119.     Harvest()
  120. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement