1gA

Modified AE2 Autoresupply

1gA
Dec 8th, 2021 (edited)
553
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Original source: https://www.reddit.com/r/feedthebeast/comments/4pei7y/ie_ae2_computercraft_open_peripherals/
  3. https://pastebin.com/J62TRZD1
  4. --]]
  5.  
  6. i = peripheral.wrap("top")
  7. c = peripheral.wrap("left")
  8.  
  9. stock_multiple = 64
  10.  
  11. while true do
  12.     sleep_time = 1
  13.     for k, item in pairs(c.getAllStacks()) do
  14.         item_basic = item.basic()
  15.         ae_info = i.getItemDetail(item_basic)
  16.         if ae_info ~= nil then
  17.             amount = ae_info.basic().qty
  18.             amount_to_stock = item_basic.qty * stock_multiple
  19.             if amount < amount_to_stock then
  20.                 diff = amount_to_stock - amount
  21.                 print("requesting " .. item_basic.name)
  22.                 print("current: " .. amount .. " additional: " .. diff)
  23.                 i.requestCrafting(item.basic(), diff)
  24.                 sleep_time = 5
  25.             else
  26.                 print(item_basic.name .. " sufficient at: " .. amount)
  27.             end
  28.         else
  29.             print(item.basic().name .. " has no crafting recipe.")
  30.         end
  31.     end
  32.     os.sleep(sleep_time)
  33. end
RAW Paste Data