mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-05-11 21:30: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 = {}
|
local groups = {}
|
||||||
|
|
||||||
-- First consume all non-group requirements
|
-- 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
|
for key, count in pairs(consumption_with_groups) do
|
||||||
if key:sub(1, 6) == "group:" then
|
if key:sub(1, 6) == "group:" then
|
||||||
groups[#groups + 1] = key:sub(7, #key)
|
groups[#groups + 1] = key:sub(7, #key)
|
||||||
@ -101,6 +102,7 @@ end
|
|||||||
|
|
||||||
local function autocraft(inventory, craft)
|
local function autocraft(inventory, craft)
|
||||||
if not craft then return false end
|
if not craft then return false end
|
||||||
|
|
||||||
-- check if output and all replacements fit in dst
|
-- check if output and all replacements fit in dst
|
||||||
local output = craft.output.item
|
local output = craft.output.item
|
||||||
local out_items = count_index(craft.decremented_input.items)
|
local out_items = count_index(craft.decremented_input.items)
|
||||||
@ -124,12 +126,14 @@ local function autocraft(inventory, craft)
|
|||||||
if empty_count < 0 then
|
if empty_count < 0 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- check if we have enough material available
|
-- check if we have enough material available
|
||||||
local inv_index = count_index(inventory:get_list("src"))
|
local inv_index = count_index(inventory:get_list("src"))
|
||||||
local consumption = calculate_consumption(inv_index, craft.consumption)
|
local consumption = calculate_consumption(inv_index, craft.consumption)
|
||||||
if not consumption then
|
if not consumption then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
for itemname, number in pairs(consumption) do
|
for itemname, number in pairs(consumption) do
|
||||||
if (not inv_index[itemname]) or inv_index[itemname] < number then return false end
|
if (not inv_index[itemname]) or inv_index[itemname] < number then return false end
|
||||||
end
|
end
|
||||||
@ -251,7 +255,8 @@ local function on_output_change(pos, inventory, stack)
|
|||||||
end
|
end
|
||||||
width_idx = (width_idx < 3) and (width_idx + 1) or 1
|
width_idx = (width_idx < 3) and (width_idx + 1) or 1
|
||||||
end
|
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
|
end
|
||||||
after_recipe_change(pos, inventory)
|
after_recipe_change(pos, inventory)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user