From 3a335e9de2e7874f0f6ba87bf0555a7be74c1d15 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Mon, 14 Apr 2014 19:01:29 +0100 Subject: [PATCH 1/3] A couple of fixes to item overriding This resolves several problems, including the one repeatedly reported in the mod's forum topic about "insane recipes". --- init.lua | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/init.lua b/init.lua index 70a66ff..303f0d8 100644 --- a/init.lua +++ b/init.lua @@ -36,26 +36,21 @@ function food.support(group,mod,item) return end - local mtype = "item" - - if minetest.registered_nodes[item] then - mtype = "node" - end - local data = minetest.registered_items[item] - if not data then print("[FOOD MOD WARNING] item '"..item.."' not found") return end - data.groups["food_"..group]=1 - - if mtype == "item" then - minetest.register_craftitem(":"..item,data) - else - minetest.register_node(":"..item,data) + -- Need to copy this table, not modify it in place, otherwise it can change + -- the groups for ALL craftitems that use the default groups. + g = {} + for k, v in pairs(data.groups) do + g[k] = v end + g["food_"..group] = 1 + minetest.override_item(item, {groups = g}) + food.supported[group] = true end From 90344ad00ac57aa04465ebbb4ffefc583cd82bbf Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Mon, 14 Apr 2014 19:02:43 +0100 Subject: [PATCH 2/3] Support both kinds of animalmaterials eggs --- init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/init.lua b/init.lua index 303f0d8..593254d 100644 --- a/init.lua +++ b/init.lua @@ -158,6 +158,7 @@ food.support("milk","animalmaterials","animalmaterials:milk") food.support("milk","my_mobs","my_mobs:milk_glass_cup") food.support("milk","jkanimals","jkanimals:bucket_milk") food.support("egg","animalmaterials","animalmaterials:egg") +food.support("egg","animalmaterials","animalmaterials:egg_big") food.support("egg","jkanimals","jkanimals:egg") food.support("meat_raw","animalmaterials","animalmaterials:meat_raw") food.support("meat","mobs","mobs:meat") From f2508662f718381d917e08bdb94e57bdf37afb84 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Mon, 14 Apr 2014 19:03:04 +0100 Subject: [PATCH 3/3] Minor typo fix --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 593254d..e1b0cd9 100644 --- a/init.lua +++ b/init.lua @@ -172,7 +172,7 @@ food.support("cup","vessels","vessels:drinking_glass") food.support("sugar","jkfarming","jkfarming:sugar") food.support("sugar","bushes_classic","bushes:sugar") --- Default inbuilt ingrediants +-- Default inbuilt ingredients food.asupport("wheat",function() minetest.register_craftitem("food:wheat", { description = S("Wheat"),