Add flag-tracking compass functionality #1286
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.
Firstly, sorry for just making this without discussing the design first. Turns out I needed to get this done much sooner than I expected. Luckily it's a pretty easy implementation so if it gets thrown away & replaced by something better it's not much work lost.
This PR adds the ability to have compasses that track flags. Specifically, it uses this XML syntax:
or
Can you have multiple different compasses?
I'm pretty sure a player cannot have multiple compasses with different targets in a vanilla client.
Why put this on flags instead of compass items?
Putting the filter on the flags, instead of on compass items, will make it clear to map makers they can't treat different compasses differently. It also makes the filter simpler if other kinds of targets are added — hills or cores could also have compass filters, and the filters will always filter players, and not some weird mishmash of objectives and locations.
What happens if multiple filters match the player?
Right now it would probably visually just track one, while sending updates for both. Practically I'm not really sure what could be done here. This is one of the major drawbacks of this design.
What about tracking players?
I'm not sure how this design could be extended for player tracking, which is the other major drawback of this design. Perhaps there's a clean way that I'm missing at 3 am, or perhaps we'll need to rethink this entirely. See #1114 for discussion on this.
What about tracking multiple things & clicking the compass?
This could easily be added — increment a variable when the player clicks the compass and filter on variables. I don't think right click actions are currently available, but they are planned so that's an easy future extension of this.
My other concern with this PR is how it filters all the players every tick. Some quick testing seems to indicate that this isn't an issue, and in my mind I'd be surprised if it was an issue expect with pathological filters, but I'm not familiar enough with PGM to be confident.