Don't add a recipe to the main list if it contains any unknown items/groups

This commit is contained in:
Vanessa Ezekowitz 2015-07-30 08:03:29 -04:00
parent 2355dc6fc2
commit 56892b8e75

13
api.lua
View File

@ -19,12 +19,25 @@ minetest.after(0.01, function()
local recipes = minetest.get_all_craft_recipes(name) local recipes = minetest.get_all_craft_recipes(name)
if recipes then if recipes then
for _, recipe in ipairs(recipes) do for _, recipe in ipairs(recipes) do
local unknowns
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
unknowns = true
end
end
if not unknowns then
unified_inventory.register_craft(recipe) unified_inventory.register_craft(recipe)
end end
end end
end end
end end
end end
end
table.sort(unified_inventory.items_list) table.sort(unified_inventory.items_list)
unified_inventory.items_list_size = #unified_inventory.items_list unified_inventory.items_list_size = #unified_inventory.items_list
print("Unified Inventory. inventory size: "..unified_inventory.items_list_size) print("Unified Inventory. inventory size: "..unified_inventory.items_list_size)