Check recipe validity
This commit is contained in:
parent
5762d89011
commit
109fcba8c2
@ -44,10 +44,9 @@ function crafting.register_craft(def)
|
|||||||
local itemstack = ItemStack(def.output)
|
local itemstack = ItemStack(def.output)
|
||||||
local itemkey = itemstack:to_string()
|
local itemkey = itemstack:to_string()
|
||||||
|
|
||||||
if crafting.registered_crafts[itemkey] ~= nil then
|
-- Each output item may only be used once. There can't be 2 recipes with
|
||||||
minetest.log("warning",
|
-- the exact same output
|
||||||
"Tried to register an existing craft " .. itemkey .. ", allowing")
|
assert(crafting.registered_crafts[itemkey] == nil, "Crafting recipe collision! itemkey="..itemkey.." def="..dump(def))
|
||||||
end
|
|
||||||
|
|
||||||
if not minetest.registered_items[itemstack:get_name()] then
|
if not minetest.registered_items[itemstack:get_name()] then
|
||||||
minetest.log("warning",
|
minetest.log("warning",
|
||||||
@ -61,7 +60,7 @@ function crafting.register_craft(def)
|
|||||||
groups = def.groups or crafting.default_craftdef.groups,
|
groups = def.groups or crafting.default_craftdef.groups,
|
||||||
}
|
}
|
||||||
|
|
||||||
if #craftdef.items > 4 then
|
if #craftdef.items > crafting.max_inputs then
|
||||||
minetest.log("warning",
|
minetest.log("warning",
|
||||||
"Attempting to register craft " .. itemkey .." with more than "
|
"Attempting to register craft " .. itemkey .." with more than "
|
||||||
.. crafting.max_inputs .. " inputs, allowing")
|
.. crafting.max_inputs .. " inputs, allowing")
|
||||||
|
Loading…
Reference in New Issue
Block a user