Skip to content
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

Add PlayerInteractEntityEvent #646

Merged
merged 2 commits into from
Aug 9, 2022
Merged

Conversation

S3v3Nice
Copy link

@S3v3Nice S3v3Nice commented Aug 7, 2022

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note
  • I am responsible for any copyright issues with my code if it occurs in the future.

@dreamguxiang
Copy link
Member

dreamguxiang commented Aug 8, 2022

ItemUseOnActorEvent is required to exist if the player intersects with an entity that exists only on the client. This usually exists when the server sends a entity packet to the client (for NPC plugins)

@S3v3Nice
Copy link
Author

S3v3Nice commented Aug 8, 2022

if the player intersects with an entity

What do you mean by 'intersects'? I checked, the event is triggered only when the player interacts with the entity with the right or left mouse button.

mInteractiveMode didn't clearly indicate whether the button was left or right, so I decided to add an enum. Plus it wasn't clear which player did it, so I added the mPlayer field. Plus there was a field with a RuntimeId of actor, but it wasn't convenient, so I made the field with Actor object. So it turns out that it' s better to create a separate event (PlayerInteractEntityEvent) for compatibility.

What's the problem with using the new event instead of the old one? I'm not suggesting you delete the old one right away, let it be marked as deprecated or you can just leave it (although I do not understand who use this event, if there is not even a field mPlayer).

@dreamguxiang
Copy link
Member

if the player intersects with an entity

What do you mean by 'intersects'? I checked, the event is triggered only when the player interacts with the entity with the right or left mouse button.

mInteractiveMode didn't clearly indicate whether the button was left or right, so I decided to add an enum. Plus it wasn't clear which player did it, so I added the mPlayer field. Plus there was a field with a RuntimeId of actor, but it wasn't convenient, so I made the field with Actor object. So it turns out that it' s better to create a separate event (PlayerInteractEntityEvent) for compatibility.

What's the problem with using the new event instead of the old one? I'm not suggesting you delete the old one right away, let it be marked as deprecated or you can just leave it (although I do not understand who use this event, if there is not even a field mPlayer).

If the entity does not exist in the server, it will not own the actor object, Only the runtimeid can be used to determine it.

try Player::AddEntityPacket

ItemUseOnActorEvent you can also change to a better name instead of deprecating

@S3v3Nice
Copy link
Author

S3v3Nice commented Aug 8, 2022

Okay, what about this?

@dreamguxiang dreamguxiang merged commit b781496 into LiteLDev:beta Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants