Advertisement
Guest User

Untitled

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