Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chest = peripheral.wrap("back")
- --local oreExt = peripheral.wrap("extractor_6") -- ore extractor
- --local dustExt = peripheral.wrap("extractor_7") -- dust extractor
- local size = chest.getInventorySize()
- local oresDir = "south"
- local dustsDir = "north"
- local oArray = {"15:0", --iron ore
- "30888:17", --iron solution
- "14:0", --gold
- "30888:18",
- "2001:1", -- tin
- "30900:2",--tin
- "2001:2",-- silver
- "30900:18",
- "2001:0", --copper
- "30900:6",
- "1060:0" -- copper
- }
- local dArray = {"30888:1", --iron dust
- "30888:9", --iron slurry
- "30888:2", --gold dust
- "30888:10",
- "30900:1", --tin dust
- "30900:0",
- "30900:16",--silver
- "30900:17",
- "30900:4",--copper
- "30900:5"}
- print("size is: " .. size)
- --see if item is extractable
- function isOre(ore)
- for k,v in pairs(oArray) do
- if (ore == v) then
- return true
- end
- end
- return false
- end
- function isDust(dust)
- for x,y in pairs(dArray) do
- if (dust == y) then
- return true
- end
- end
- return false
- end
- --isOre(15)
- --loop throught the inventory
- function sendStuff()
- 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"])
- --print (combID)
- --print (type(combID))
- if (isOre(combID)) then
- --print(id["name"])
- chest.pushItem(oresDir,i,64)
- elseif (isDust(combID)) then
- --print(id["name"])
- chest.pushItem(dustsDir,i,64)
- end
- end
- end
- end
- while true do
- sendStuff()
- end
- --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