Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chests_stock = {}
- local chest_bees
- local chest_bees_label = "ironchest:diamond_chest_48"
- local centrifuges = {}
- local apiary_sto = {}
- local periphs_labels = {}
- local blacklist_comb = {"rock_honeycomb","rgbee_honeycomb","woody_honeycomb","nether_honeycomb"}
- modem = peripheral.wrap("bottom")
- periphs_labels = modem.getNamesRemote()
- chest_bees = peripheral.wrap(chest_bees_label)
- for i,periph in pairs(periphs_labels) do
- if string.find(periph,"chest") and periph ~= chest_bees_label then
- table.insert(chests_stock,peripheral.wrap(periph))
- elseif string.find(periph,"centrifuge") then
- table.insert(centrifuges,peripheral.wrap(periph))
- elseif string.find(periph,"apiary_storage") then
- table.insert(apiary_sto,peripheral.wrap(periph))
- end
- end
- function has_value(tableau, valeur)
- for i, item in pairs(tableau) do
- if string.find(valeur, item) then
- return true
- end
- end
- return false
- end
- function apiaryToProcess()
- while true do
- for j=2,7 do
- if not centrifuges[1].getItemDetail(j) then
- for i,item in pairs(apiary_sto[1].list()) do
- if not has_value(blacklist_comb, item.name) and string.find(item.name, "honeycomb") then
- centrifuges[1].pullItems(peripheral.getName(apiary_sto[1]), i, 1)
- break
- end
- end
- end
- end
- end
- end
- function chestToProcess()
- while true do
- for j=2,7 do
- broke = false
- if not centrifuges[1].getItemDetail(j) then
- for c,chest in pairs(chests_stock) do
- for i,item in pairs(chest.list()) do
- if not has_value(blacklist_comb, item.name) and string.find(item.name, "honeycomb") then
- centrifuges[1].pullItems(peripheral.getName(chest), i, 1)
- broke = true
- end
- if broke then break end
- end
- if broke then break end
- end
- end
- end
- end
- end
- function outProcess()
- while true do
- stockFull = false
- for j,item in pairs(centrifuges[1].list()) do
- --itemOut = centrifuges[1].getItemDetail(j)
- if j>7 then
- for c,chest in pairs(chests_stock) do
- item.count = item.count - centrifuges[1].pushItems(peripheral.getName(chest),j)
- if item.count <= 0 then
- break
- end
- end
- end
- end
- end
- end
- while true do
- parallel.waitForAny(chestToProcess,outProcess,apiaryToProcess)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement