Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --VAR--
- local barrel = peripheral.wrap("top")
- local diss = peripheral.wrap("bottom")
- local outChest = peripheral.wrap("left")
- local dissSlots = diss.size()
- local slotWithItems = 0
- local outputWithItems = 2
- --FUNCTION--
- function CheckForChemInBarrel(barr)
- local i = 0
- for slot, item in pairs(barr.list()) do
- i = i + 1
- if item.count >= 1 then
- slotWithItems = slot
- return true
- else
- slotWithItems = 0
- return false
- end
- end
- end
- function PushItems()
- barrel.pushItems(peripheral.getName(diss), slotWithItems, 64, 1)
- end
- function PushItemsToOutput()
- while dissSlots > 1 do
- diss.pushItemsToOutput(peripheral.getName(outChest), dissSlots)
- dissSlots = dissSlots - 1
- end
- dissSlots = diss.size()
- end
- function Timer(time)
- os.startTimer(time)
- os.pullEvent("timer")
- end
- --MAIN--
- while true do
- local dissData = diss.getItemDetail(1)
- local dissOutputData = diss.getItemDetail(2)
- print("Loop Started")
- if not dissData then
- if CheckForChemInBarrel(barrel) then
- PushItems()
- print("Items have been put in")
- else
- print("Barrel has no Items")
- end
- else
- print("Dissolver has Items")
- end
- if dissOutputData then
- print("Item is being transfered to Output Chest")
- PushItemsToOutput()
- end
- Timer(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement