Advertisement
avartoon15

fafarm

Oct 22nd, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.25 KB | None | 0 0
  1. -- harvest
  2. function harvest()
  3.   x = 0
  4.  
  5.   term.clear()
  6.   term.setCursorPos(15,6)
  7.   print("** working **")
  8.  
  9.   turtle.dig()
  10.   turtle.forward()
  11.   turtle.dig()
  12.  
  13.   while turtle.detectUp() == true do
  14.     turtle.digUp()
  15.     turtle.up()
  16.     turtle.dig()
  17.     x = x+1
  18.   end
  19.  
  20.   turtle.turnLeft()
  21.   turtle.dig()
  22.   turtle.forward()
  23.   turtle.turnRight()
  24.   turtle.dig()
  25.  
  26.   for i=1, x do
  27.     turtle.digDown()
  28.     turtle.down()
  29.     turtle.dig()
  30.   end
  31.  
  32.   turtle.back()
  33.   turtle.turnLeft()
  34.   turtle.back()
  35.   turtle.turnRight()
  36.  
  37.   x = 0
  38.  
  39. end
  40.  
  41. --plant
  42. function plant()
  43.   term.clear()
  44.   term.setCursorPos(15,6)
  45.   print("** working **")
  46.   turtle.digUp()
  47.   turtle.up()
  48.   turtle.forward()
  49.   turtle.select(16)
  50.   turtle.placeDown()
  51.   turtle.forward()
  52.   turtle.placeDown()
  53.   turtle.turnLeft()
  54.   turtle.forward()
  55.   turtle.turnLeft()
  56.   turtle.placeDown()
  57.   turtle.forward()
  58.   turtle.placeDown()
  59.   turtle.dig()
  60.   turtle.forward()
  61.   turtle.turnLeft()
  62.   turtle.forward()
  63.   turtle.turnLeft()
  64.   turtle.down()
  65. end
  66.  
  67. -- refuel
  68. function fuel()
  69.   while turtle.getFuelLevel() < 1000 do
  70.     turtle.select(15)
  71.     turtle.suck(2)
  72.     turtle.refuel(2)
  73.   end
  74. end
  75.  
  76. --drop
  77.  
  78. function drop()
  79.   turtle.select(1)
  80.   turtle.dropDown()
  81.   turtle.select(2)
  82.   turtle.dropDown()
  83.   turtle.select(3)
  84.   turtle.dropDown()
  85.   turtle.select(4)
  86.   turtle.dropDown()
  87.   turtle.select(5)
  88.   turtle.dropDown()
  89.   turtle.select(6)
  90.   turtle.dropDown()
  91.   turtle.select(7)
  92.   turtle.dropDown()
  93.   turtle.select(8)
  94.   turtle.dropDown()
  95.   turtle.select(9)
  96.   turtle.dropDown()
  97.   turtle.select(10)
  98.   turtle.dropDown()
  99.   turtle.select(11)
  100.   turtle.dropDown()
  101.   turtle.select(12)
  102.   turtle.dropDown()
  103.   turtle.select(13)
  104.   turtle.dropDown()
  105.   turtle.select(14)
  106.   turtle.dropDown()
  107.   turtle.select(15)
  108.   turtle.dropDown()
  109.   turtle.select(16)
  110.   turtle.dropDown()
  111. end
  112.  
  113. --compare
  114. function compare()
  115. turtle.select(16)
  116.     while turtle.compare() == true do
  117.       term.clear()
  118.       term.setCursorPos(15,6)
  119.       print("** sleep: zZzZzZz **")
  120.       sleep(15)
  121.     end
  122.     harvest()
  123. end
  124.  
  125. while true do
  126.   compare()
  127.   turtle.turnLeft()
  128.   drop()
  129.   turtle.turnLeft()
  130.   fuel()
  131.   turtle.turnLeft()
  132.   turtle.select(16)
  133.   turtle.suck(5)
  134.   turtle.turnLeft()
  135.   plant()
  136. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement