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

Do not keep player in trackedPlayers if the Pre track event was cance… #119

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

Cryptite
Copy link
Contributor

@Cryptite Cryptite commented Feb 7, 2024

This is perhaps not the the best way go to about it, but in our case this was causing an issue.

If you hadn't otherwise provided a tracking rule, but still wanted to cancel the pre track event, you could never subsequently track an NPC because the player was already in the trackedPlayers collection, despite having been cancelled.

@derklaro
Copy link
Collaborator

derklaro commented Feb 7, 2024

Nice catch! How about not adding the player to the list first, calling the event, check-adding him if not cancelled?

Pseudo code:

if !players.contains(p)
  if call(event).cancelled()
    return
    
  if players.add(p)
    return
    
  ...

@Cryptite
Copy link
Contributor Author

Cryptite commented Feb 8, 2024

Yeah I suppose contains could be slightly more performant than a guaranteed add and remove, which would have the set being reordered twice.

@derklaro derklaro merged commit 36e6dc6 into juliarn:v3 Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants