MigasRocha

Carrot Farm "Cyclical"

Dec 1st, 2023 (edited)
550
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.32 KB | Gaming | 0 0
  1. x = 0
  2. y = 9
  3. c = 0
  4. z = 1 ---Futura contagem de vezes---
  5.  
  6. function refuel()
  7.    
  8.     if turtle.getFuelLevel() < 500 then
  9.         turtle.select(16)
  10.         turtle.placeUp()
  11.         turtle.suckUp()
  12.         turtle.refuel()
  13.         turtle.dropUp()
  14.         turtle.digUp()
  15.         turtle.select(1)
  16.     end
  17. end
  18.  
  19.  
  20.  
  21. function Deploying()
  22.  
  23.     term.setTextColor(colors.purple)
  24.     print("Deploying Items...")
  25.                    
  26.         turtle.select(15)
  27.         turtle.placeUp()
  28.     for drop=1,14 do
  29.         turtle.select(drop)
  30.         turtle.dropUp()
  31.         end
  32.     turtle.select(15)
  33.     turtle.digUp()
  34.     turtle.select(1)
  35.    
  36.     term.setTextColor(colors.green)
  37.     print("Items Deployed")
  38.     term.setTextColor(colors.blue)
  39.     print("Entering StandBy Mode")
  40.     sleep(180)
  41. end
  42.  
  43.  
  44.  
  45.  
  46. function base()
  47.  
  48.     refuel()
  49.     for frente=1,10 do
  50.         turtle.forward()
  51.     end
  52.  
  53. turtle.turnLeft()
  54.    
  55. for frente2=1,11 do
  56.         turtle.forward()
  57.     end
  58.         turtle.turnLeft()
  59.        
  60.     c = 0
  61.     term.setTextColor(colors.lime)
  62.     print("Base Reached...")
  63.     z = z+1
  64.  
  65.     if turtle.getItemCount(1) ~=0 then
  66.         print("Deploying")
  67.         Deploying()
  68.     else
  69.         print("No Items Acquired Restarting Cycle")
  70.         cycle()
  71.     end
  72.  
  73.  
  74. end
  75.  
  76.  
  77.  
  78.  
  79. function turnAround(colunas)
  80.  
  81.     if (colunas%2) == 0 then
  82.     turtle.turnRight()
  83.     turtle.forward()
  84.     turtle.turnRight()
  85.     else
  86.     turtle.turnLeft()
  87.     turtle.forward()
  88.     turtle.turnLeft()
  89.     end
  90. end
  91.  
  92.  
  93.  
  94. function cycle()
  95.  
  96. term.clear()
  97.     term.setCursorPos(1,1)
  98.     term.setTextColor(colors.orange)
  99.     print("Starting Work Number:",z)
  100.    
  101.     for colunas=1,11 do
  102.     refuel()
  103.     c= c+1
  104.     for frente=x+1,10 do
  105.         x= x+1
  106.         turtle.forward()
  107.         local harvest, data = turtle.inspectDown()
  108.             if harvest == true then
  109.                 if data.state.age == 7 then
  110.                     turtle.select(1)
  111.                     turtle.digDown()
  112.                     turtle.placeDown()
  113.                  end
  114.             end
  115.         end
  116.     if x == 10 then
  117.     x = 0
  118.     end
  119.    
  120. turnAround(colunas)
  121.  
  122. if c == 11 then
  123.         term.setTextColor(colors.green)
  124.         print("Work Done...")
  125.         print("Going Home...")
  126.         base()
  127.     end
  128. end
  129.     end    
  130. while true do
  131. cycle()
  132. end
Add Comment
Please, Sign In to add comment