aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryou <ovvv@web.de>2018-02-18 10:40:14 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2018-02-18 10:40:14 +0100
commit46bbacee95b8cc68b7e531232a319ed46c2e1560 (patch)
treeec044cae77e26b41fce1a3a9230e12071cc8bb78
parentae6aed15cfd95e6efbdcf4eb1f6de2697acd8c13 (diff)
downloadminetest-46bbacee95b8cc68b7e531232a319ed46c2e1560.tar.gz
minetest-46bbacee95b8cc68b7e531232a319ed46c2e1560.tar.bz2
minetest-46bbacee95b8cc68b7e531232a319ed46c2e1560.zip
Fix "Ignoring CONTENT_IGNORE redefinition" warning (#4393)
minetest.override_item still passes to core
-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 15d9b42d0..5ce8caf3a 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)