Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chest = peripheral.wrap("gold_1")
- local extractor = peripheral.wrap("container_chest_1")
- --local oreExt = peripheral.wrap("extractor_6") -- ore extractor
- local size = chest.getInventorySize()
- local oresDir = "north"
- local backDir = "north"
- local oresToPush = {}
- local ores = {"15:0","14:0", "2001:0"}
- print("size is: " .. size)
- --see if item is extractable
- function isOre(ore)
- for k,v in pairs(ores) do
- if (ore == v) then
- return true
- end
- end
- return false
- end
- --loop throught the inventory
- function stuffToSend()
- --chest.condenseItems()
- for i=1,size do
- --print (i)
- local id = chest.getStackInSlot(i)
- if (id ~= nil) then
- local combID = tostring(id["id"])..":"..tostring(id["dmg"])
- local iName = tostring(id["name"])
- --print (combID)
- print (iName)
- if isOre(combID) and string.find(iName, "Ore") ~= nil then
- --print(id["name"])
- local leng = table.getn(oresToPush) + 1
- oresToPush[leng] = i
- --chest.pushItem(oresDir,i,64)
- end
- end
- end
- sendStuff()
- end
- function sendStuff()
- if table.getn(oresToPush) ~= 0 then
- for k,v in pairs(oresToPush) do
- print (chest.getStackInSlot(v)["name"])
- while chest.getStackInSlot(v) ~= nil do
- chest.pushItem(oresDir,v,64)
- os.sleep(0.5)
- print ("loop")
- end
- end
- end
- oresToPush = {}
- end
- stuffToSend()
- --function pullOres(slot)
- -- oreExt.pushItem(dustsDir, slot, 64)
- --end
- --function pullDusts(slot)
- -- dustExt.pushItem(oresDir, slot, 64)
- --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement