Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local function checkFuel()
  2.   if turtle.getFuelLevel() < 100 then
  3.     select(16)
  4.     if turtle.getItemCount() >= 100 then
  5.       for i=0,100 do
  6.         turtle.refuel()
  7.       end
  8.     else
  9.       textutils.slowPrint("Please refuel")
  10.     end
  11.   end
  12. end
  13.  
  14. local function checkStock()
  15.   select(2)
  16.   if turtle.getItemCount() == 0 then
  17.     print("Not enough seeds")    
  18.   end
  19. end
  20.  
  21. local function farm()
  22.   select(5)
  23.   turtle.digDown()
  24. end
  25.  
  26. local function move()
  27.   if turtle.inspectDown() != 44:3 then
  28.     turtle.forward()
  29.   else
  30.     if dir==1 then
  31.       turtle.turnLeft()
  32.       turtle.forward()
  33.       if turtle.inspectDown() != 44:3 then
  34.         turtle.back()
  35.         turtle.turnLeft()
  36.       else
  37.         turtle.turnLeft()
  38.         turtle.forward()
  39.         dir = 2
  40.       end
  41.     end
  42.     if dir == 2 then
  43.       turtle.turnRight()
  44.       turtle.forward()
  45.       if turtle.inspectDown() != 44:3 then
  46.         turtle.back()
  47.         turtle.turnRight()
  48.       else
  49.         turtle.turnRight()
  50.         turtle.forward()
  51.         dir = 1        
  52.       end
  53.     end
  54.   end
  55.  
  56. end
  57.  
  58. while true do
  59.   checkFuel()
  60.   checkStock()
  61.   farm()
  62.   move()
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement