Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ci = peripheral.find("colonyIntegrator") or error("No CoIn attached", 0)
- bridge = peripheral.find("meBridge") or error("No meBridge attached", 0)
- -- ME system extraction
- function meExtract (eItem, eCount)
- sItem = tostring(eItem)
- --print(sItem)
- result = bridge.exportItem({name=sItem, count=eCount}, "up") -- error("failed export", 0)
- print(result)
- end
- woOrder = ci.getWorkOrders()
- for i=1, #woOrder,1 do
- -- retrieve table for resources for work order
- woID = tonumber(woOrder[i].id)
- woOrResources = ci.getWorkOrderResources(woID)
- -- check through resources
- for r=1, #woOrResources,1 do
- availability = woOrResources[r].available
- print("----")
- print(woOrResources[r].displayName, availability)
- if availability == 0 then
- print("none found, extracting")
- meExtract(woOrResources[r].item.name, woOrResources[r].needed)
- else
- print("skipping")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment