Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------------
- -- Программа: генератор укрепленного камня --
- -- для роботов из мода OpenComputers --
- -- проект http://computercraft.ru --
- -- Version 0.1(eeprom) --
- -- 2019, © Asior --
- -------------------------------------------------------
- --инструмент: любой бур; 1: леса железные; 2: песок; 3: распылитель; рука: бур/кирка/ваджа
- --расширения: инвентарь, контроллер инвентаря
- r = component.proxy(component.list("robot")())
- ic = component.proxy(component.list("inventory_controller")())
- local function sleep(timeout)
- local deadline = computer.uptime() + (timeout or 0)
- repeat
- computer.pullSignal(0)
- until computer.uptime() >= deadline
- end
- local function import()
- if r.count(1) <= 2 or r.count(2) <= 2 then
- r.select(1)
- for n = 1, 2 do
- if r.count(n) == 0 then
- error('Нет нужных ресурсов')
- end
- label = ic.getStackInInternalSlot(n).label
- for i=1,ic.getInventorySize(1) do
- name = ic.getStackInSlot(1,i)
- if name then
- if name.label == label then
- ic.suckFromSlot(1,i,63-r.count(n),n)
- break
- end
- end
- end
- end
- end
- end
- local function refuel()
- r.select(3)
- r.turn(true)
- ic.equip()
- r.drop(3)
- for i=4,16 do
- if r.count(i)>0 then
- r.select(i)
- r.drop(0,64)
- end
- end
- sleep(20)
- r.select(3)
- r.suck(3)
- r.turn(false)
- r.turn(false)
- ic.equip()
- r.drop(3)
- sleep(15)
- r.suck(3)
- r.turn(true)
- end
- while true do
- for i=1, 80 do
- r.select(1)
- r.place(3)
- r.select(3)
- ic.equip()
- r.use(3)
- r.select(2)
- ic.equip()
- r.use(3)
- ic.equip()
- r.select(3)
- ic.equip()
- r.swing(3)
- import()
- end
- refuel()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement