mirror of
https://github.com/mt-mods/pipeworks.git
synced 2025-05-11 05:10:22 +02:00
bugfix: when item has no groups
"" and unknown items have no def and thus no groups
This commit is contained in:
parent
978b5c723e
commit
7c210a5841
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user