-
Notifications
You must be signed in to change notification settings - Fork 671
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
MultiServer: add all worlds goal completion message #2956
Conversation
Is it tested with item links? (since item links make fake player slots) |
Just tested, groups are always considered goal completed by the server. They cause no issue for this implementation. |
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.
A nice fun bit of celebration when a multiworld finishes, I like it
Tested with three Cliques, two of which shared their buttons in an item link Everything worked as expected.
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.
Code LGTM. I think this is the first time I've seen a for/else in real code (and liked it).
MultiServer.py
Outdated
@@ -1839,6 +1839,15 @@ def update_client_status(ctx: Context, client: Client, new_status: ClientStatus) | |||
if current != ClientStatus.CLIENT_GOAL: # can't undo goal completion | |||
if new_status == ClientStatus.CLIENT_GOAL: | |||
ctx.on_goal_achieved(client) | |||
relevant_players = [player for player in ctx.player_names |
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.
Maybe rest_of_team
or other_players_in_team
would be even clearer?
MultiServer.py
Outdated
relevant_players = [player for player in ctx.player_names | ||
if player[0] == client.team and player[1] != client.slot] | ||
for player in relevant_players: | ||
if player not in ctx.client_game_state: | ||
break # player has yet to ever connect to the server | ||
if ctx.client_game_state[player] != ClientStatus.CLIENT_GOAL: | ||
break | ||
else: | ||
ctx.broadcast_text_all(f"Team #{client.team + 1} has completed all of their games! Congratulations!") |
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.
relevant_players = [player for player in ctx.player_names | |
if player[0] == client.team and player[1] != client.slot] | |
for player in relevant_players: | |
if player not in ctx.client_game_state: | |
break # player has yet to ever connect to the server | |
if ctx.client_game_state[player] != ClientStatus.CLIENT_GOAL: | |
break | |
else: | |
ctx.broadcast_text_all(f"Team #{client.team + 1} has completed all of their games! Congratulations!") | |
if all(player in ctx.client_game_state and ctx.client_game_state[player] == ClientStatus.CLIENT_GOAL for player in ctx.player_names if player[0] in client.team): | |
ctx.broadcast_text_all(f"Team #{client.team + 1} has completed all of their games! Congratulations!") |
didn't test, just wrote it up in github.
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.
You'd need to ignore the current player (since ctx.client_game_state is not changed yet), but this probably works. I'll test it soon.
Co-authored-by: Doug Hoskisson <[email protected]>
What is this fixing or adding?
Upon the last world in a team sending goal completion, a message is sent to all players congratulating the team.
How was this tested?
Several games of multiple Clique, confirming that the message would only be sent on the final goal completion.
If this makes graphical changes, please attach screenshots.