Advertisement
Guest User

Untitled

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