Fix group replacements in Quick Crafting
This commit is contained in:
parent
b4482f0acf
commit
b6b97aa284
|
@ -444,12 +444,22 @@ local function craft_stack(player, data, craft_rcp)
|
||||||
for _ = 1, v * scrbar_val do
|
for _ = 1, v * scrbar_val do
|
||||||
inv:remove_item("main", item)
|
inv:remove_item("main", item)
|
||||||
|
|
||||||
if rcp_def.replacements then
|
for _, pair in ipairs(rcp_def.replacements or {}) do
|
||||||
for _, pair in ipairs(rcp_def.replacements) do
|
local old_name, new_name = unpack(pair)
|
||||||
if item == pair[1] then
|
|
||||||
get_stack(player, ItemStack(pair[2]))
|
if is_group(old_name) then
|
||||||
|
local groups = extract_groups(old_name)
|
||||||
|
local groupname = old_name:sub(7)
|
||||||
|
local item_groups = i3.groups[groupname].items or groups_to_items(groups)
|
||||||
|
|
||||||
|
for _, it in ipairs(item_groups) do
|
||||||
|
if item == it then
|
||||||
|
get_stack(player, ItemStack(new_name))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif item == old_name then
|
||||||
|
get_stack(player, ItemStack(new_name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Ŝarĝante…
Reference in New Issue