Quantum Resource Distribution deprecated

by eliont

Logistic buffer chest will send placed items to ship quantum storage unit if no logistic request set. If logistic request exist and can be fulfilled using stored items, items instead taken from storage and placed in chest inventory. It's make resourse management more like RTS for playing combat-oriented settings/mods. Compatible with multi-surface mods like SE. UPS-friendly.

Content
1 year, 3 months ago
1.1
186
Logistics Logistic network Circuit network Storage

g Fulfill partial requests

1 year, 4 months ago

Hi, I am using the mod in my new SE K2 playthrough and have noticed that the storage appears to only provide items if it can satisfy the whole request. ie I have 9 iron gears in storage and am requesting 10, it won't provide any iron gears to the chest. Is there a way to change this behavior? ie let it provide the 9 gears while production catches up

1 year, 4 months ago
(updated 1 year, 4 months ago)

So after digging through a LUA guide and checking the factorio modding guide, I was able to modify the "take" and "put" functions to do what I was looking for. I will paste the modifications here if anyone is interested. This in in the control.lua file.

function take(surface,inv,item,amount)
if not global.pool[surface.name] then global.pool[surface.name] = {} end
if not global.pool[surface.name][item] then global.pool[surface.name][item] = 0 end
if global.restricted[item] == true then return end

local maxstore = 99999

if global.pool[surface.name][item] + amount > maxstore then amount = maxstore - global.pool[surface.name][item] end
if amount <= 0 then return end
global.pool[surface.name][item] = global.pool[surface.name][item] + amount
inv.remove({name=item, count=amount})
end

function put(surface,inv,item,amount)
if not global.pool[surface.name][item] then return end -- ignore if item isn't in pool
if inv.get_insertable_count(item) < amount then amount = inv.get_insertable_count(item) end

local content = inv.get_contents()
local needed = amount

if content[item] then needed = needed - content[item] end
if needed <= 0 then return end
if global.pool[surface.name][item] < needed then needed = global.pool[surface.name][item] end
if needed <= 0 then return end

global.pool[surface.name][item] = global.pool[surface.name][item] - needed
inv.insert({name=item, count=needed})
end