mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 02:00:37 +01:00
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:
parent
035b95ace1
commit
8bdbb19271
@ -24,12 +24,22 @@ minetest.after(0.01, function()
|
|||||||
|
|
||||||
for _,chk in pairs(recipe.items) do
|
for _,chk in pairs(recipe.items) do
|
||||||
local groupchk = string.find(chk, "group:")
|
local groupchk = string.find(chk, "group:")
|
||||||
if (not groupchk and not minetest.registered_items[chk])
|
if groupchk then
|
||||||
or (groupchk and not unified_inventory.get_group_item(string.gsub(chk, "group:", "")).item) 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
|
unknowns = true
|
||||||
if minetest.setting_getbool("show_unknown_craftrecipes") then
|
if minetest.setting_getbool("show_unknown_craftrecipes") then
|
||||||
minetest.log("error", "Recipe for item " .. recipe.output .. " contains unknown item " .. chk)
|
minetest.log("error", "Recipe for item " .. recipe.output .. " contains unknown item " .. chk)
|
||||||
end
|
end
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user