New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable "Ignoring CONTENT_IGNORE redefinition" warning #4393
Conversation
builtin/game/register.lua
Outdated
@@ -303,7 +303,7 @@ core.register_node(":air", { | |||
groups = {not_in_creative_inventory=1}, | |||
}) | |||
|
|||
core.register_node(":ignore", { | |||
core.registered_nodes["ignore"] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need some fields more, if you do it without register_node
.
name = "ignore",
mod_origin = core.get_current_modname()
You probably should also have its metatable __index
point to core.nodedef_default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@t4im fixed
OK for me, it kind of makes sense? 👍. I can see this being useful for other things like hand, air and a few more things. |
Build problems? |
Looks good but I would prefer another term for easier understanding. How about |
l agree; l called it @paramat it disappeared after rebasing |
I'm not completely sure about this. Is this because air and ignore can't be redefined? |
it seems a little bit hacky for a single node, maybe we should just merge contentfeatures ? |
When making mods you can use this to e.g. add the on_blast function to some node definition without redundantly passing everything to minetest core. |
No don't do that it permits to prevent node définitions conflicts for mods => obsolete comment
|
Context: I deleted my comment, that was just before nerzhul's, where i suggested moving the message to infostream. |
Could anybody donate a second approval? |
How about just disabling the warning for the ignore node only, to keep it simple? |
Do you mean explicitly avoiding printing this warning when the node is CONTENT_IGNORE? |
Yes, but it's just a suggestion, it might not be a good idea. |
l think that would be a workaround. The "ignore" node is overriden in register.lua that mods which use node definitions (e.g. minetest.registered_nodes[minetest.get_node(pos).name]) can easily treat ignore like other nodes, e.g. test whether it's walkable. |
l could also temporarily override |
I don't like this, it feels hacky and a misfeature just to prevent this warning. It feels like a lot of ugliness for a small issue. I suggest:
Number 2 sounds better to me. It would be: function core.register_item(name, itemdef)
local is_overriding = core.registered_items[name]
-- rest of function
-- Don't register ignore with the engine
if name ~= "ignore" then
register_item_raw(name, def)
elseif is_overriding then
minetest.log("warning", "Ignoring CONTENT_IGNORE redefinition")
end
end |
Done |
Thanks, no objections from me. |
👍 |
Hmmm. I'm not sure if I understood this right. Does this always disable the warning, or just when IMO the warning does make sense when you try to overwrite |
That's what will happen |
builtin/game/register.lua
Outdated
if name ~= "ignore" then | ||
register_item_raw(itemdef) | ||
elseif is_overriding then | ||
minetest.log("warning", "Attempted redefinition of \"ignore\"") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the core
namespace in builtin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done,
l also changed the comment because avoiding mods to register ignore to core is just a redundant side effect.
minetest.override_item still passes to core
👍 |
@rubenwardy: You answer was not hellpful. :-( |
It avoids registering ignore to core if it's registered the first time in lua, i.e. in builtin. |
Ah, good. That's what I wanted to hear. :-) |
minetest.override_item still passes to core
minetest.override_item still passes to core
minetest.override_item still passes to core
minetest.override_item still passes to core
Revert "Fix "Ignoring CONTENT_IGNORE redefinition" warning (minetest#4393)" This reverts commit 46bbace. Then do the ignore tests in l_item.cpp instead of builtin/
minetest.override_item still passes to core
Revert "Fix "Ignoring CONTENT_IGNORE redefinition" warning (minetest#4393)" This reverts commit 46bbace. Then do the ignore tests in l_item.cpp instead of builtin/
minetest.override_item still passes to core
minetest.override_item still passes to core
minetest.override_item still passes to core
Addresses #6276