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

Core: Improve join/leave messages, add "HintGame" tag #2859

Merged
merged 5 commits into from
May 2, 2024

Conversation

EmilyV99
Copy link
Contributor

What is this fixing or adding?

  • Adds the HintGame tag, for projects like BKSudoku/APSudoku/HintMachine (this tag, like TextOnly/Tracker, allows ignore_game)
  • Adds new verbs to join messages:
    • hinting for HintGame
    • (unchanged) tracking for Tracker
    • viewing for TextOnly
    • Default (unchanged) playing
  • Adds verbs to leave messages (which were previously completely lacking)
    • stopped hinting for HintGame
    • stopped tracking for Tracker
    • stopped viewing for TextOnly
    • Default (unchanged) left
  • Adds client version/tags info to leave messages (same as it was previously on join messages)

Where multiple tags that have associated verbs are on the same client, it picks the first applicable verb, in tag order HintGame, Tracker, TextOnly, default.

How was this tested?

Connected and disconnected with various tags, using CommonClient for TextOnly, and my own APSudoku project with various sets/combinations of tags.

If this makes graphical changes, please attach screenshots.

image
image
image

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Feb 24, 2024
Copy link
Contributor

@benny-dreamly benny-dreamly left a comment

Choose a reason for hiding this comment

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

I like this change. Was unable to test but it looks fairly straightforward from the code.

Copy link
Collaborator

@remyjette remyjette left a comment

Choose a reason for hiding this comment

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

Created a world on my multiserver with the text client, poptracker, and a game. All worked as expected.

Some minor suggestions, really appreciate this change!

MultiServer.py Outdated
Comment on lines 809 to 814
for tag, verb in verbs.items():
if tag in client.tags:
final_verb = verb
break
else:
final_verb = "playing"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be done with a generator expression and next()

I guess it's a stylistic choice as it should perform the same but to me it reads cleaner than a for/else so figured i'd suggest it
 

Suggested change
for tag, verb in verbs.items():
if tag in client.tags:
final_verb = verb
break
else:
final_verb = "playing"
final_verb = next((verb for tag, verb in verbs.items() if tag in client.tags), "playing")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personally I find this far less readable than the for/else

ctx.broadcast_text_all(
"%s (Team #%d) has left the game" % (ctx.get_aliased_name(client.team, client.slot), client.team + 1),
f"{ctx.get_aliased_name(client.team, client.slot)} (Team #{client.team + 1}) has {final_verb} the game. "
f"Client({version_str}), {client.tags}.",
Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm not sure the client version/tags are necessary for leaving, but that might just be me.

But I love the change from "left" to "stopped tracking", will alleviate confusion for sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tags is helpful, because for instance my APSudoku hint game has the "APSudoku" tag- so it gives an extra level of clarity to the leave message.

@ScipioWright ScipioWright added the is: enhancement Issues requesting new features or pull requests implementing new features. label Feb 26, 2024
@beauxq
Copy link
Collaborator

beauxq commented Mar 2, 2024

Instead of creating 3 new data objects in 3 different places, do we want to just create 1? EmilyV99#3

@PoryGone PoryGone added waiting-on: author Issue/PR is waiting for feedback or changes from its author. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Mar 5, 2024
MultiServer.py Outdated Show resolved Hide resolved
@EmilyV99 EmilyV99 requested a review from beauxq March 7, 2024 19:56
Copy link
Collaborator

@beauxq beauxq left a comment

Choose a reason for hiding this comment

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

looked at code changes (with linting, type-checking)

looks like it will work and be good

didn't test it

@BadMagic100 BadMagic100 added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: author Issue/PR is waiting for feedback or changes from its author. labels Mar 23, 2024
@NewSoupVi NewSoupVi merged commit ea6235e into ArchipelagoMW:main May 2, 2024
3 checks passed
jnschurig pushed a commit to Tranquilite0/Archipelago-SoulBlazer that referenced this pull request Jun 13, 2024
…2859)

* Add better "verbs" on joining msg, and improve leaving msgs

* Add 'HintGame' tag, for projects like BKSudoku/APSudoku/HintMachine

* data in one place instead of 3

* Clean up 'ignore_game' loop to use any() instead

---------

Co-authored-by: beauxq <[email protected]>
qwint pushed a commit to qwint/Archipelago that referenced this pull request Jun 24, 2024
…2859)

* Add better "verbs" on joining msg, and improve leaving msgs

* Add 'HintGame' tag, for projects like BKSudoku/APSudoku/HintMachine

* data in one place instead of 3

* Clean up 'ignore_game' loop to use any() instead

---------

Co-authored-by: beauxq <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants