Client: Only allow pointing with interact priv #14745
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trivial UX improvement: When you don't have interact, you can't point at anything anymore, to signal that you are unable to interact with anything.
Previously, client prediction made it look as if you were still able to interact with things, even though the server ignores the interactions. You could still point at things, "dig" nodes (clientside), "punch" and "kill" entities clientside.
Provides a solution for part of the use case behind #14742: Simply revoking
interact
should now work well. Care needs to be taken to re-grantinteract
on player join, since privs are persisted.The use case of tools that can't point at anything is however still valid, but a bit trickier to solve.
If we were to change behavior and make
range = 0
=> no pointing, the fix would be trivial: Addd > 0 &&
to the condition. (Oh also, it looks like you can still point at nodes you are inside of when you are in third person?)(However, with a negative range or similar, it's a bit trickier: We already use a negative value (
-1
) as the default for "no value". This was what led me down the route of NaN back then, which in hindsight was a bad idea.)How to test
interact
priv of second client