-
Notifications
You must be signed in to change notification settings - Fork 24
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
Protected chests lack ability to forge keys #378
Comments
Sounds good in theory but i'm not sure if this will over-complicate things on the usage- and maybe code-side too 🤔 |
Didn't really check but I don't think this will complicate code that much really and probably can be fairly easily implemented, pretty much completely isolated and optional feature without sprinkling config or mod checks everywhere. Pretty sure it is just extra functions added for nodes and nothing else so should be able to be pretty much completely enclosed in its own lua files easily. But I also remember looking at something like this with another mod and somehow remember there might have been other issues with keys, just can't remember what it was... I think, if implemented, these can however be up to the server owner assumin it is configurable instead of always available thing. |
Possibly starting to remember something I think it might have been that implementation I was talking about was a bit hacky involving additional external state tracking and protection overrides for key usage. |
Should be fairly easy to add, just need to copy the code here and adjust it for protected chests: technic/technic_chests/register.lua Lines 201 to 219 in bb70986
To decide who can make a key, it would make sense to use minetest.is_protected .
|
On the other hand this can cause issues with revoking access if owner used both keys and protection, basically owner can't be sure who has a key. Sure there's both upsides and downsides on this but I think likely for those who don't know exact underlying logic it would be safer and still good enough to require actual owner to make keys, I mean it isn't immediately obvious who can make keys and for other implementations I think it is always restricted only to owner. I'd say best to carefully weight upsides and downsides from average players perspective rather than from mod developer or power users perspective. |
It may, quite everything I proposed for the doors redo mod last year was merged except this exact same concept: protection levels for protected areas
Code side is not really that complex. |
I looked up a bit and saw there is no owner meta for protected chests. For this mod, this approach would require to set owner meta when placing a protected chest |
This branch kind of works but without owner meta, protected chests are not able to use the default.can_interact_with_node function from MTG. May PR be good to retrieve feedback and comments ? Or is it better to work separate until more advanced work ? |
Automating it probably wont end well as we have no idea who's the owner. This fact that there's no owner meta and that key crafting authorization would work completely different actually gives feeling that this probably should not be done just like that. Technically on lua code everything is simple and easy to do but end result for delivered functionality is going to be both different from similar functionality and rather complicated. Trying out and comparing different approaches beforehand, even if just on paper, would be best thing to do here.
Yes @mazes-80 PR or even multiple PRs for different approaches (if you happen to have alternatives) would be good. |
I added an owner meta branch. The branch allows:
From an user perspective: owner field for protected chest is:
|
Use case: allow a "guest" to use a protected chest even he is not member of one area.
Notice: creating an area limited to the specific chest also works, but it consumes one area protection "slot", by default you don't own that many slot as a classical user.
Adding a on_skeleton_key_use() and defining ways to open chest seems quite straightforward.
May also require to think of who can emit keys: only chest owner ? all people owning the area ? Only people listed able to make keys by the owner ? Another checkbox to define who can per chest ?
The text was updated successfully, but these errors were encountered: