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

Dynamic filters! #914

Merged
merged 29 commits into from
Oct 2, 2021
Merged

Dynamic filters! #914

merged 29 commits into from
Oct 2, 2021

Conversation

KingOfSquares
Copy link
Contributor

Dynamic filters 🔮:tada:

This PR proposes an implementation of the dynamic filter concept originally introduced in ProjectAres.
In addition it also comes bundled with:

  • A refactor of the Portal feature to be able to use dynamic filters for triggering (the other use-cases like kits/scoreboxes/structures can be added later)
  • Removal of Player, Party and Match #getQuery since they now implement Filterable (which means that the objects implement the query instead)
  • Add a TODO in PlayerQuery about some wrong usage (the fix is not in scope for this PR)

After this PR any feature in PGM can register FilterListeners through #onChange/onRise/onFall which will enable the feature to be able to trigger functionality whenever a dynamic filter matches/unmatches its condition.

From the outside, the functionality of dynamic filters is quite similar to how it was in ProjectAres with one exception. Filters now have to override #getRelevantEvents and declare which events should be listened to that could change a filters opinion on someone (e.g. if KillStreakFilter is used MatchPlayerDeathEvent should be listened for because that might change a filters opinion on a player). If it does not override the method the filter is regarded as non-dynamic.

On the inside (inside FilterMatchModule) there have been changes from how ProjectAres solved it.
Before, FilterMatchModule would listen for a set of hardcoded events (here) and invalidate players/the match whenever those events where called.
In this PR, the module only listens for events that the filters say are relevant (Filter#getRelevantEvents()). If multiple filters need the same event it is only listened for once.

This new approach enables more types of filters to be dynamic, and allows the module to be more precise in when to invalidate someone.

In addition to all the old dynamic filters (excluding the time filter) the following filters are now dynamic:

  • kill-streak
  • carrying (item)
  • holding (item)
  • wearing (item)
    Also, all filters with children(also query modifiers) are dynamic if their child(ren) are

@Electroid Please remember to credit both me and Pugzy in the final commit

The testing of these changes was powered by the diamyx-pack

@Electroid Electroid changed the title Dynamic filters(!) Dynamic filters! Aug 22, 2021
Copy link
Member

@Electroid Electroid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool to see both of your work on this. I've done a high-level pass, but we'll need some more reviews

@CoWinkKeyDinkInc
Copy link
Contributor

#836 Can be recreated after this PR is merged

Pugzy and others added 20 commits September 1, 2021 11:49
- Also removed MatchPlayerState as a filterable.

Signed-off-by: KingSimon <[email protected]>
Signed-off-by: KingSimon <[email protected]>
Co-Authored-By: KingOfSquares <[email protected]>
Signed-off-by: KingSimon <[email protected]>
Co-Authored-By: KingOfSquares <[email protected]>
Signed-off-by: KingSimon <[email protected]>
Signed-off-by: KingSimon <[email protected]>
- formatting included

Signed-off-by: KingSimon <[email protected]>
…trary events

Signed-off-by: KingSimon <[email protected]>

squASH

Signed-off-by: KingSimon <[email protected]>
Signed-off-by: KingSimon <[email protected]>

Scope MethodHandle creating to Entityy instead of PLayer

Signed-off-by: KingSimon <[email protected]>
Signed-off-by: KingSimon <[email protected]>
Pugzy and others added 4 commits September 1, 2021 11:49
- Also remove illegal symbol :(

Signed-off-by: KingSimon <[email protected]>
- Change semantics in MultiFilterFunction#getRelevantEvents

Signed-off-by: KingSimon <[email protected]>
- Move some methods from interface to implementation

Signed-off-by: KingSimon <[email protected]>
@Electroid Electroid merged commit e9e5d42 into PGMDev:dev Oct 2, 2021
@KingOfSquares KingOfSquares mentioned this pull request Nov 14, 2021
20 tasks
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.

5 participants