forked from mtcontrib/food
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".
This commit is contained in:
parent
9de90d2766
commit
3a335e9de2
21
init.lua
21
init.lua
@ -36,26 +36,21 @@ function food.support(group,mod,item)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local mtype = "item"
|
|
||||||
|
|
||||||
if minetest.registered_nodes[item] then
|
|
||||||
mtype = "node"
|
|
||||||
end
|
|
||||||
|
|
||||||
local data = minetest.registered_items[item]
|
local data = minetest.registered_items[item]
|
||||||
|
|
||||||
if not data then
|
if not data then
|
||||||
print("[FOOD MOD WARNING] item '"..item.."' not found")
|
print("[FOOD MOD WARNING] item '"..item.."' not found")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
data.groups["food_"..group]=1
|
-- Need to copy this table, not modify it in place, otherwise it can change
|
||||||
|
-- the groups for ALL craftitems that use the default groups.
|
||||||
if mtype == "item" then
|
g = {}
|
||||||
minetest.register_craftitem(":"..item,data)
|
for k, v in pairs(data.groups) do
|
||||||
else
|
g[k] = v
|
||||||
minetest.register_node(":"..item,data)
|
|
||||||
end
|
end
|
||||||
|
g["food_"..group] = 1
|
||||||
|
minetest.override_item(item, {groups = g})
|
||||||
|
|
||||||
food.supported[group] = true
|
food.supported[group] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user