mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-05-11 05:10:22 +02:00
only whitespace changes
This commit is contained in:
parent
2f70be2d90
commit
9be6239ec5
@ -49,7 +49,8 @@ local function calculate_consumption(inv_index, consumption_with_groups)
|
||||
local groups = {}
|
||||
|
||||
-- First consume all non-group requirements
|
||||
-- This is done to avoid consuming a non-group item which is also in a group
|
||||
-- This is done to avoid consuming a non-group item which is also
|
||||
-- in a group
|
||||
for key, count in pairs(consumption_with_groups) do
|
||||
if key:sub(1, 6) == "group:" then
|
||||
groups[#groups + 1] = key:sub(7, #key)
|
||||
@ -101,6 +102,7 @@ end
|
||||
|
||||
local function autocraft(inventory, craft)
|
||||
if not craft then return false end
|
||||
|
||||
-- check if output and all replacements fit in dst
|
||||
local output = craft.output.item
|
||||
local out_items = count_index(craft.decremented_input.items)
|
||||
@ -124,12 +126,14 @@ local function autocraft(inventory, craft)
|
||||
if empty_count < 0 then
|
||||
return false
|
||||
end
|
||||
|
||||
-- check if we have enough material available
|
||||
local inv_index = count_index(inventory:get_list("src"))
|
||||
local consumption = calculate_consumption(inv_index, craft.consumption)
|
||||
if not consumption then
|
||||
return false
|
||||
end
|
||||
|
||||
for itemname, number in pairs(consumption) do
|
||||
if (not inv_index[itemname]) or inv_index[itemname] < number then return false end
|
||||
end
|
||||
@ -251,7 +255,8 @@ local function on_output_change(pos, inventory, stack)
|
||||
end
|
||||
width_idx = (width_idx < 3) and (width_idx + 1) or 1
|
||||
end
|
||||
-- we'll set the output slot in after_recipe_change to the actual result of the new recipe
|
||||
-- we'll set the output slot in after_recipe_change to the actual
|
||||
-- result of the new recipe
|
||||
end
|
||||
after_recipe_change(pos, inventory)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user