Make unified_inventory able to check multiple groups at once

- Modified code in unified_inventory's api.lua to check every group in a recipe. Eg.: group:flora,colour_green.
   Both groups flora and colour_green will be checked.
This commit is contained in:
LeMagnesium 2015-08-10 16:51:49 +02:00
parent 035b95ace1
commit 8bdbb19271
1 changed files with 12 additions and 2 deletions

View File

@ -24,12 +24,22 @@ minetest.after(0.01, function()
for _,chk in pairs(recipe.items) do
local groupchk = string.find(chk, "group:")
if (not groupchk and not minetest.registered_items[chk])
or (groupchk and not unified_inventory.get_group_item(string.gsub(chk, "group:", "")).item) then
if groupchk then
for _,groupname in pairs(string.gsub(chk, "group:", ""):split(",")) do
if not unified_inventory.get_group_item(groupname).item then
unknowns = true
if minetest.setting_getbool("show_unknown_craftrecipes") then
minetest.log("error", "Recipe for item " .. recipe.output .. " contains unknown group " .. groupname)
end
break
end
end
elseif not minetest.registered_items[chk] then
unknowns = true
if minetest.setting_getbool("show_unknown_craftrecipes") then
minetest.log("error", "Recipe for item " .. recipe.output .. " contains unknown item " .. chk)
end
break
end
end