Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.20 KB | None | 0 0
  1. local alto = 6
  2. local ancho = 8
  3. local combustible = "ic2:fluid_cell"
  4. local semilla = "mysticalagriculture:tier1_inferium_seeds"
  5. local cofre = "enderstorage:ender_storage"
  6.  
  7. function seleccionarItem(nombre)
  8.  
  9.     for i = 1,16 do
  10.       turtle.select(i)
  11.       local data = turtle.getItemDetail
  12.      
  13.       if nombre == data.name then
  14.             turtle.select(i)
  15.             return true
  16.             --break
  17.       end
  18.      
  19.       if i == 16 and nombre ~= data.name then
  20.           print("No se pudo encontrar el item " .. nombre)
  21.           return false
  22.       end
  23.      
  24.     end
  25. end
  26.  
  27. function recargar()
  28.    
  29.     turtle.dig()
  30.     if seleccionarItem(cofre) then
  31.         turtle.place()
  32.         turtle.suck()
  33.     else
  34.         exit()
  35.     end
  36.    
  37.     if seleccionarItem(combustible) then
  38.         turtle.refuel(1)
  39.         turtle.dig()
  40.         if seleccionarItem(semillas) == false then exit() end
  41.     else
  42.         print("sin combustible")
  43.         turtle.up()
  44.         exit()
  45.     end
  46. end
  47.  
  48. function plantarAlto()
  49.    
  50.     if turtle.getFuelLevel() < alto then
  51.         recargar()
  52.     end
  53.    
  54.     for i=1,alto do
  55.         local success, data = turtle.inspectDown()
  56.        
  57.         if success then
  58.             if data.metadata == 7 then
  59.                 turtle.digDown()
  60.                 seleccionarItem(semillas)
  61.                 turtle.placeDown()
  62.             end
  63.         end
  64.        
  65.         if i ~= alto then
  66.             turtle.forward()
  67.         end
  68.     end  
  69. end
  70.  
  71. print("empezamos")
  72. if turtle.getFuelLevel() < alto then
  73.     recargar()
  74. end
  75.  
  76. while true do
  77.  
  78.     for i=1,ancho do
  79.         plantarAlto()
  80.        
  81.         if (i % 2 == 0) then
  82.             turtle.turnLeft()
  83.             turtle.forward()
  84.             turtle.turnLeft()
  85.         else
  86.             turtle.turnRight()
  87.             turtle.forward()
  88.             turtle.turnRight()
  89.         end  
  90.    
  91.     end
  92.  
  93.     turtle.turnLeft()
  94.     turtle.turnLeft()
  95.    
  96.     for i=1,ancho do    
  97.         plantarAlto()
  98.        
  99.         if (i % 2 == 0) then
  100.             turtle.turnRight()
  101.             turtle.forward()
  102.             turtle.turnRight()
  103.         else
  104.             turtle.turnLeft()
  105.             turtle.forward()
  106.             turtle.turnLeft()
  107.         end
  108.     end
  109.    
  110.     turtle.turnLeft()
  111.     turtle.turnLeft()
  112.  
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement