Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------------
- -- Программа --
- -- для сушки мяса и других вещей на досках вяления --
- -- в Майнкрафт на компьютере и транспозере --
- -- из мода OpenComputers --
- -- Автовялилка v0.1 --
- -- проект http://computercraft.ru --
- -- 2017, © Asior --
- ---------------------------------------------------------
- local c = require("component")
- local computer = require("computer")
- local function sortirovka(adr, input)
- local size = c.proxy(adr).getStackInSlot(1, 1)
- if size and size.size <= 9 then
- print('< 9')
- for i=3, c.proxy(adr).getInventorySize(1) do
- local info = c.proxy(adr).getStackInSlot(1, i)
- print(tostring(info)..'|'..tostring(input.name))
- if info and info.name == input.name then
- for i1=1, 10 do
- if not c.proxy(adr).transferItem(1, 1, 1, i) then
- sortirovka(adr, input)
- return
- end
- end
- return
- end
- end
- end
- end
- ------------------------------------------
- tr = {}
- for i, _ in pairs(c.list('transposer')) do
- tr[#tr + 1] = i
- end
- while true do
- for i1 = 1, #tr do
- local input = c.proxy(tr[i1]).getStackInSlot(1, 1)
- local output = c.proxy(tr[i1]).getStackInSlot(1, 2)
- for i = 2, 5 do
- local name = c.proxy(tr[i1]).getStackInSlot(i, 1)
- if i == 2 then sortirovka(tr[i1], input) end
- if name and name.name == output.name then
- print(name.name..'|1|'..output.name..'|'..i1)
- c.proxy(tr[i1]).transferItem(i, 1)
- c.proxy(tr[i1]).transferItem(1, i)
- elseif name == nil then
- c.proxy(tr[i1]).transferItem(1, i)
- end
- end
- end
- print('sleep')
- os.sleep(50)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement