ivanzrer

Untitled

Nov 1st, 2024
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. ci = peripheral.find("colonyIntegrator") or error("No CoIn attached", 0)
  2. bridge = peripheral.find("meBridge") or error("No meBridge attached", 0)
  3.  
  4. -- ME system extraction
  5. function meExtract (eItem, eCount)
  6. sItem = tostring(eItem)
  7. --print(sItem)
  8. result = bridge.exportItem({name=sItem, count=eCount}, "up") -- error("failed export", 0)
  9. print(result)
  10. end
  11.  
  12. woOrder = ci.getWorkOrders()
  13.  
  14. for i=1, #woOrder,1 do
  15. -- retrieve table for resources for work order
  16. woID = tonumber(woOrder[i].id)
  17. woOrResources = ci.getWorkOrderResources(woID)
  18.  
  19. -- check through resources
  20. for r=1, #woOrResources,1 do
  21. availability = woOrResources[r].available
  22. print("----")
  23. print(woOrResources[r].displayName, availability)
  24. if availability == 0 then
  25. print("none found, extracting")
  26. meExtract(woOrResources[r].item.name, woOrResources[r].needed)
  27. else
  28. print("skipping")
  29. end
  30. end
  31. end
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment