Warn when a mod registers a stairs node with an existing name

This commit is contained in:
HybridDog 2019-07-30 11:19:22 +02:00 committed by sfan5
parent 7f830124f7
commit a2254bd0af
1 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,12 @@ local function rotate_and_place(itemstack, placer, pointed_thing)
return minetest.item_place(itemstack, placer, pointed_thing, param2) return minetest.item_place(itemstack, placer, pointed_thing, param2)
end end
local function warn_if_exists(nodename)
if minetest.registered_nodes[nodename] then
minetest.log("warning", "Overwriting stairs node: " .. nodename)
end
end
-- Register stair -- Register stair
-- Node will be called stairs:stair_<subname> -- Node will be called stairs:stair_<subname>
@ -73,6 +79,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
end end
local new_groups = table.copy(groups) local new_groups = table.copy(groups)
new_groups.stair = 1 new_groups.stair = 1
warn_if_exists("stairs:stair_" .. subname)
minetest.register_node(":stairs:stair_" .. subname, { minetest.register_node(":stairs:stair_" .. subname, {
description = description, description = description,
drawtype = "nodebox", drawtype = "nodebox",
@ -167,6 +174,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
end end
local new_groups = table.copy(groups) local new_groups = table.copy(groups)
new_groups.slab = 1 new_groups.slab = 1
warn_if_exists("stairs:slab_" .. subname)
minetest.register_node(":stairs:slab_" .. subname, { minetest.register_node(":stairs:slab_" .. subname, {
description = description, description = description,
drawtype = "nodebox", drawtype = "nodebox",
@ -307,6 +315,7 @@ function stairs.register_stair_inner(subname, recipeitem, groups, images,
end end
local new_groups = table.copy(groups) local new_groups = table.copy(groups)
new_groups.stair = 1 new_groups.stair = 1
warn_if_exists("stairs:stair_inner_" .. subname)
minetest.register_node(":stairs:stair_inner_" .. subname, { minetest.register_node(":stairs:stair_inner_" .. subname, {
description = "Inner " .. description, description = "Inner " .. description,
drawtype = "nodebox", drawtype = "nodebox",
@ -388,6 +397,7 @@ function stairs.register_stair_outer(subname, recipeitem, groups, images,
end end
local new_groups = table.copy(groups) local new_groups = table.copy(groups)
new_groups.stair = 1 new_groups.stair = 1
warn_if_exists("stairs:stair_outer_" .. subname)
minetest.register_node(":stairs:stair_outer_" .. subname, { minetest.register_node(":stairs:stair_outer_" .. subname, {
description = "Outer " .. description, description = "Outer " .. description,
drawtype = "nodebox", drawtype = "nodebox",