Advertisement
Asioron

generator_kam

Sep 14th, 2019
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. -------------------------------------------------------
  2. --     Программа: генератор укрепленного камня       --
  3. --         для роботов из мода OpenComputers         --
  4. --          проект http://computercraft.ru           --
  5. --              Version 0.1(basic)                   --
  6. --                 2019, © Asior                     --
  7. -------------------------------------------------------
  8. --инструмент: любой бур; 1: леса железные; 2: песок; 3: распылитель
  9. --расширения: инвентарь, контроллер инвентаря
  10.  
  11. local c = require("component")
  12. local r = require('robot')
  13. local ic = c.inventory_controller
  14.  
  15. local function import()
  16.   if r.count(1) <= 2 or r.count(2) <= 2 then
  17.     r.select(1)
  18.     for n = 1, 2 do
  19.       if r.count(n) == 0 then
  20.         error('Нет нужных ресурсов')
  21.       end
  22.       label = ic.getStackInInternalSlot(n).label
  23.       for i=1,ic.getInventorySize(1) do
  24.         name = ic.getStackInSlot(1,i)
  25.         if name then
  26.           if name.label == label then
  27.             ic.suckFromSlot(1,i,63-r.count(n),n)
  28.             break
  29.           end
  30.         end
  31.       end
  32.     end
  33.   end
  34. end
  35.  
  36. local function refuel()
  37.   r.select(3)
  38.   r.turnRight()
  39.   ic.equip()
  40.   r.drop()
  41.   for i=4,16 do
  42.     if r.count(i)>0 then
  43.       r.select(i)
  44.       r.dropDown(64)
  45.     end
  46.   end
  47.   os.sleep(20)
  48.   r.select(3)
  49.   r.suck()
  50.   r.turnLeft()
  51.   r.turnLeft()
  52.   ic.equip()
  53.   r.drop()
  54.   os.sleep(15)
  55.   r.suck()
  56.   r.turnRight()
  57. end
  58.  
  59. while true do
  60.   for i=1, 80 do  --8000/100
  61.     r.select(1) --поставить леса
  62.     r.place()
  63.     r.select(3) --залить леса
  64.     ic.equip()
  65.     r.use()
  66.     r.select(2) --засыпать бетон
  67.     ic.equip()
  68.     r.use()
  69.     ic.equip()
  70.     r.select(3) --снять бетон
  71.     ic.equip()
  72.     r.swing()
  73.     import()
  74.   end
  75.   refuel()
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement