-
Notifications
You must be signed in to change notification settings - Fork 657
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
Conversation
There was a problem hiding this 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.
There was a problem hiding this 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
for tag, verb in verbs.items(): | ||
if tag in client.tags: | ||
final_verb = verb | ||
break | ||
else: | ||
final_verb = "playing" |
There was a problem hiding this comment.
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
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") |
There was a problem hiding this comment.
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}.", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Instead of creating 3 new data objects in 3 different places, do we want to just create 1? EmilyV99#3 |
data in one place instead of 3
There was a problem hiding this 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
…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]>
…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]>
What is this fixing or adding?
HintGame
tag, for projects like BKSudoku/APSudoku/HintMachine (this tag, likeTextOnly
/Tracker
, allowsignore_game
)hinting
forHintGame
tracking
forTracker
viewing
forTextOnly
playing
stopped hinting
forHintGame
stopped tracking
forTracker
stopped viewing
forTextOnly
left
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
forTextOnly
, and my ownAPSudoku
project with various sets/combinations of tags.If this makes graphical changes, please attach screenshots.