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
Extend protection api to allow for protection from specific actions #2250
Comments
This is a brilliant idea :) |
Seems like a good idea, but it won't be efficient. If we were using Lua 5.2 or above we could use bitops, and with 5.3 we have operators for them, but in the abscence of those it will have to be a table like
|
👍 |
I have another suggestion for an improvement in the protection API. The current API can be used to prevent users from making changes in areas that are owned by others. However, it is not possible to also grant users additional powers in areas that they do own, powers they can't use elsewhere. I propose that the API be changed so that is_protected returns two values: whether the player can perform the requested action, and whether it has any special authority over the node at all:
For existing users, nothing changes (they still use the 'access_denied' value, which tells them all they need). Any new mod could use the area_protected value to grant additional powers that the player does not have elsewhere. |
Could be interesting. |
+1 |
I was thinking about strings, which lua interns anyway. So comparisons are done on identity, which should not have a very big performance impact.
|
Any core dev interest? Nerzhul expressed possible interest 3 years ago. |
No core dev support or response for 3+ years so closing. Core devs feel free to reopen if you support it. |
Status quo
boolean minetest.is_protected(pos, name)
Currently lacks returning the protection status depending on conditions:
i.e. against what is being protected.
Proposal
I propose a simple backward compatible extension of
is_protected
, that does not require any code change.After the decision to make it public api and add to the documentation mods could instantly begin to use it, as it is being directly passed to the protection mods.
boolean minetest.is_protected(pos, name, action)
if
action == nil
or unknown assume our current status quo, that is permissions todig
orplace
, which are the most frequent checked actions anyway.nil
and assume the same in that case.Examples
inventory
actions (by simply having that check in the inventory callbacks). This would allow placing public technic machines there for everyone to use without having to fear those machines getting "misplaced".fill
allowing players to allow others to fill up that renewable water even in protected areas but not to do anything else.The text was updated successfully, but these errors were encountered: