You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry if this is a duplicate or isn't formatted properly. I looked for a tiny bit to see if there was a thread opened by appgurueu but I couldn't find one, and this is my first time using GitHub
There is no official engine function or way (to my knowledge) to remove an unwanted variable - such as "on_use" in this case. Currently I set it to false as a method of committing to this - but this isn't an officially supported way of doing such.
Solutions
Two solutions were proposed by appgurueu and with comments by @Montandalar (BlockHead)
appgurueu's solutions:
I think we should have a way to let override_item delete fields, that definitely seems like a legitimate feature to me. One way to implement this could be using a special, unique minetest.nil_placeholder (could be a userdatum) which could be used instead of false (the problem with false is that it does not work for fields which support booleans; for other fields it's fine however). Or adding another parameter with a list of fields to be deleted?
Montandalar's comment;
I think I like the delete-list better because it extends the API with an extra argument - of course, there may be weird code out there using an extra argument already, because you should expect the unexpected, but that's not really a supported use case. I like the delete-list because doesn't have a magic userdata* value which is probably what would be needed, and also would not be present in older versions whereas the delete-list would pass through and basically be ignored. I suppose that makes it a question of crash vs no crash for a bit of code that doesn't check for compatibility of what it is about to use.
The probably best solution would be to go with the second solution that appgurueu suggested: another parameter - a table of indexes to be removed. But I imagine both solutions could work out just as well?
Alternatives
Well as I mention in the problem, I currently use "false" as a way to modify a function variable so that it is not used.
Problem
Sorry if this is a duplicate or isn't formatted properly. I looked for a tiny bit to see if there was a thread opened by appgurueu but I couldn't find one, and this is my first time using GitHub
A thread I opened a few weeks ago https://forum.minetest.net/viewtopic.php?t=30405 went into detail about how to remove functions from an Item's definition. Was told I should open an issue about it by LMD aka @appgurueu :D
There is no official engine function or way (to my knowledge) to remove an unwanted variable - such as "on_use" in this case. Currently I set it to false as a method of committing to this - but this isn't an officially supported way of doing such.
Solutions
Two solutions were proposed by appgurueu and with comments by @Montandalar (BlockHead)
appgurueu's solutions:
Montandalar's comment;
The probably best solution would be to go with the second solution that appgurueu suggested: another parameter - a table of indexes to be removed. But I imagine both solutions could work out just as well?
Alternatives
Well as I mention in the problem, I currently use "false" as a way to modify a function variable so that it is not used.
Additional context
Just be sure to check https://forum.minetest.net/viewtopic.php?t=30405 for anything extra :D
The text was updated successfully, but these errors were encountered: