1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-05-10 20:50:22 +02:00

bugfix: when item has no groups

"" and unknown items have no def and thus no groups
This commit is contained in:
Luke aka SwissalpS 2023-06-15 03:40:46 +02:00
parent 978b5c723e
commit 7c210a5841

View File

@ -125,7 +125,7 @@ local function calculate_consumption(inv_index, consumption_with_groups)
for i = 1, #groups do for i = 1, #groups do
local group = groups[i] local group = groups[i]
local groupname = "group:" .. group local groupname = "group:" .. group
if item_groups[group] >= 1 and consumption_with_groups[groupname] > 0 then if item_groups[group] and item_groups[group] >= 1 and consumption_with_groups[groupname] > 0 then
local take = math.min(count, consumption_with_groups[groupname]) local take = math.min(count, consumption_with_groups[groupname])
consumption_with_groups[groupname] = consumption_with_groups[groupname] - take consumption_with_groups[groupname] = consumption_with_groups[groupname] - take
assert(consumption_with_groups[groupname] >= 0) assert(consumption_with_groups[groupname] >= 0)