aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authoryou <ovvv@web.de>2018-02-18 10:40:14 +0100
committerSmallJoker <mk939@ymail.com>2018-06-03 17:32:00 +0200
commit2a4fbbbff8f555df9984fbff054fe91b1a471d8f (patch)
treefd6db93be133885f4507314f45d01192d65447dc /builtin/game
parent6d346a817be6882b9779e6564f9c902f55cfc951 (diff)
downloadminetest-2a4fbbbff8f555df9984fbff054fe91b1a471d8f.tar.gz
minetest-2a4fbbbff8f555df9984fbff054fe91b1a471d8f.tar.bz2
minetest-2a4fbbbff8f555df9984fbff054fe91b1a471d8f.zip
Fix "Ignoring CONTENT_IGNORE redefinition" warning (#4393)
minetest.override_item still passes to core
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/register.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/builtin/game/register.lua b/builtin/game/register.lua
index ec6f28097..25af24eb7 100644
--- a/builtin/game/register.lua
+++ b/builtin/game/register.lua
@@ -116,6 +116,8 @@ function core.register_item(name, itemdef)
end
itemdef.name = name
+ local is_overriding = core.registered_items[name]
+
-- Apply defaults and add to registered_* table
if itemdef.type == "node" then
-- Use the nodebox as selection box if it's not set manually
@@ -177,7 +179,13 @@ function core.register_item(name, itemdef)
--core.log("Registering item: " .. itemdef.name)
core.registered_items[itemdef.name] = itemdef
core.registered_aliases[itemdef.name] = nil
- register_item_raw(itemdef)
+
+ -- Used to allow builtin to register ignore to registered_items
+ if name ~= "ignore" then
+ register_item_raw(itemdef)
+ elseif is_overriding then
+ core.log("warning", "Attempted redefinition of \"ignore\"")
+ end
end
function core.unregister_item(name)