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

MultiServer: add all worlds goal completion message #2956

Merged
merged 5 commits into from
Apr 14, 2024

Conversation

Silvris
Copy link
Collaborator

@Silvris Silvris commented Mar 15, 2024

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.

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 Mar 15, 2024
@beauxq
Copy link
Collaborator

beauxq commented Mar 15, 2024

Is it tested with item links? (since item links make fake player slots)

@Silvris
Copy link
Collaborator Author

Silvris commented Mar 15, 2024

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.

@remyjette remyjette added the is: enhancement Issues requesting new features or pull requests implementing new features. label Mar 15, 2024
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.

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.

Copy link
Contributor

@Ixrec Ixrec left a 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
Copy link
Contributor

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?

@Exempt-Medic Exempt-Medic 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: peer-review Issue/PR has not been reviewed by enough people yet. labels Mar 28, 2024
MultiServer.py Outdated
Comment on lines 1842 to 1850
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!")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Collaborator Author

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.

MultiServer.py Show resolved Hide resolved
MultiServer.py Outdated Show resolved Hide resolved
@Berserker66 Berserker66 merged commit f176589 into ArchipelagoMW:main Apr 14, 2024
15 checks passed
EmilyV99 pushed a commit to EmilyV99/Archipelago that referenced this pull request Apr 15, 2024
EmilyV99 pushed a commit to EmilyV99/Archipelago that referenced this pull request Apr 15, 2024
qwint pushed a commit to qwint/Archipelago that referenced this pull request Jun 24, 2024
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.

6 participants