Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local KOLVO = 1 --Количество товара
- local DELAY = 5 --задержка в секундах
- local com = require("component")
- if not com.isAvailable("redstone") then
- print("Для работы программы нужна красная карта.")
- os.exit()
- end
- local red = com.redstone
- local r = require("robot")
- local i = 0
- local er = true
- local size = r.inventorySize()
- local slotCount, slotNum = 0, 2
- r.select(1)
- if r.count() == 0 then
- print("Для работы поместите в первый слот\nробота образец предмета в кол-во 1 шт.\nНапример в первом слоте лежит 1 большой подарок.")
- end
- while true do
- while not r.suck() do end
- if r.count() >= KOLVO + 1 then
- if er then
- if slotCount >= 64 then
- slotNum = slotNum + 1
- if slotNum > size then
- print("Произошла критическая ошибка!\nНедостаточно места в инвентаре.")
- os.exit()
- end
- end
- local n = r.count() - KOLVO
- if not r.transferTo(slotNum, n) then
- if not r.transferTo(slotNum + 1, n) then
- print("Произошла критическая ошибка!\nНедостаточно места в инвентаре.")
- os.exit()
- end
- end
- slotCount = slotNum + n
- else
- if not r.dropUp(r.count() - KOLVO) then
- print("Произошла ошибка, сундук сверху не найден.\nИспользую внутренний инвентарь.")
- er = true
- end
- end
- red.setOutput(0, 10)
- i = i + 1
- print("Выполнено "..i.." платных входов")
- os.sleep(DELAY)
- red.setOutput(0, 0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement