summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-07-30 08:03:29 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-07-30 08:03:29 -0400
commit56892b8e75afdf808f2546cda29fb6cee17d05b2 (patch)
tree9fa74d99329fe986573de31155a17dddce0e0175
parent2355dc6fc27c392a4610b2951d30b5e5482fac09 (diff)
Don't add a recipe to the main list if it contains any unknown items/groups
-rw-r--r--api.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/api.lua b/api.lua
index 5f74ea7..5c87af4 100644
--- a/api.lua
+++ b/api.lua
@@ -19,7 +19,20 @@ minetest.after(0.01, function()
local recipes = minetest.get_all_craft_recipes(name)
if recipes then
for _, recipe in ipairs(recipes) do
- unified_inventory.register_craft(recipe)
+
+ 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)
+ end
end
end
end