mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
.
This commit is contained in:
@@ -439,19 +439,20 @@ local function handle_output_interfaces()
|
|||||||
vlayer_data.entity_interfaces.storage_output[index] = nil
|
vlayer_data.entity_interfaces.storage_output[index] = nil
|
||||||
else
|
else
|
||||||
local inventory = interface.get_inventory(defines.inventory.chest)
|
local inventory = interface.get_inventory(defines.inventory.chest)
|
||||||
|
local inventory_request_sections = interface.get_or_create_control_behavior().sections
|
||||||
|
|
||||||
for i = 1, interface.request_slot_count do
|
for i = 1, #inventory_request_sections do
|
||||||
local request = interface.get_request_slot(i)
|
for _, v in pairs(inventory_request_sections[i].filters) do
|
||||||
|
if v.value and config.allowed_items[v.value.name] then
|
||||||
|
local current_amount = inventory.get_item_count(v.value.name)
|
||||||
|
local request_amount = math.min(v.min - current_amount, vlayer_data.storage.items[v.value.name])
|
||||||
|
|
||||||
if request and config.allowed_items[request.name] then
|
if request_amount > 0 and inventory.can_insert{ name = v.value.name, count = request_amount } then
|
||||||
local current_amount = inventory.get_item_count(request.name)
|
local removed_item_count = vlayer.remove_item(v.value.name, request_amount)
|
||||||
local request_amount = math.min(request.count - current_amount, vlayer_data.storage.items[request.name])
|
|
||||||
|
|
||||||
if request_amount > 0 and inventory.can_insert{ name = request.name, count = request_amount } then
|
if removed_item_count > 0 then
|
||||||
local removed_item_count = vlayer.remove_item(request.name, request_amount)
|
inventory.insert{ name = v.value.name, count = removed_item_count, quality = "normal" }
|
||||||
|
end
|
||||||
if removed_item_count > 0 then
|
|
||||||
inventory.insert{ name = request.name, count = removed_item_count }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user