Skip to content

Commit

Permalink
Improve documentation of messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas authored and Askaholic committed Oct 26, 2024
1 parent 645d001 commit aeeb4c2
Showing 1 changed file with 48 additions and 24 deletions.
72 changes: 48 additions & 24 deletions server/gameconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,15 +509,20 @@ async def handle_rehost(self, *args: list[Any]):

async def handle_launch_status(self, status: str):
"""
Currently is sent with status `Rejected` if a matchmaker game failed
to start due to players using differing game settings.
Represents the launch status of a peer.
# Params
- `status`: One of "Unknown" | "Connecting" | "Missing local peers" |
"Rejoining" | "Ready" | "Ejected" | "Rejected" | "Failed"
"""
pass

async def handle_bottleneck(self, *args: list[Any]):
"""
Not sure what this command means. This is currently unused but
included for documentation purposes.
Example args: ["ack", "23381", "232191", "64218.4"]
"""
pass

Expand Down Expand Up @@ -547,6 +552,24 @@ async def handle_game_full(self):
"""
pass

async def handle_established_peers(
self,
peer_id: str,
peer_connected_to: str,
):
"""
Send by the lobby when a peer connected to another peer. Message can be
send multiple times, by multiple connections.
# Params
- `peer_id`: The identifier of the peer that this connection received
the message from
- `peer_connected_to`: The list of identifiers that the given peer
established a connection to. Is a list stored in a string, separated
by spaces. As an example: "1321 22 33 43221 2132"
"""
pass

Check warning on line 571 in server/gameconnection.py

View check run for this annotation

Codecov / codecov/patch

server/gameconnection.py#L571

Added line #L571 was not covered by tests

def _mark_dirty(self):
if self.game:
self.game_service.mark_dirty(self.game)
Expand Down Expand Up @@ -623,26 +646,27 @@ def __str__(self):


COMMAND_HANDLERS = {
"AIOption": GameConnection.handle_ai_option,
"Bottleneck": GameConnection.handle_bottleneck,
"BottleneckCleared": GameConnection.handle_bottleneck_cleared,
"Chat": GameConnection.handle_chat,
"ClearSlot": GameConnection.handle_clear_slot,
"Desync": GameConnection.handle_desync,
"Disconnected": GameConnection.handle_disconnected,
"EnforceRating": GameConnection.handle_enforce_rating,
"GameEnded": GameConnection.handle_game_ended,
"GameFull": GameConnection.handle_game_full,
"GameMods": GameConnection.handle_game_mods,
"GameOption": GameConnection.handle_game_option,
"GameResult": GameConnection.handle_game_result,
"GameState": GameConnection.handle_game_state,
"IceMsg": GameConnection.handle_ice_message,
"JsonStats": GameConnection.handle_json_stats,
"LaunchStatus": GameConnection.handle_launch_status,
"OperationComplete": GameConnection.handle_operation_complete,
"PlayerOption": GameConnection.handle_player_option,
"Rehost": GameConnection.handle_rehost,
"TeamkillHappened": GameConnection.handle_teamkill_happened,
"TeamkillReport": GameConnection.handle_teamkill_report,
"AIOption": GameConnection.handle_ai_option, # Lobby message
"Bottleneck": GameConnection.handle_bottleneck, # Lobby/game message
"BottleneckCleared": GameConnection.handle_bottleneck_cleared, # Lobby/game message
"Chat": GameConnection.handle_chat, # Lobby message
"ClearSlot": GameConnection.handle_clear_slot, # Lobby message
"Desync": GameConnection.handle_desync, # Game message
"Disconnected": GameConnection.handle_disconnected, # Lobby message
"EnforceRating": GameConnection.handle_enforce_rating, # Game message
"GameEnded": GameConnection.handle_game_ended, # Game message
"GameFull": GameConnection.handle_game_full, # Lobby message
"GameMods": GameConnection.handle_game_mods, # Lobby message
"GameOption": GameConnection.handle_game_option, # Lobby message
"GameResult": GameConnection.handle_game_result, # Game message
"GameState": GameConnection.handle_game_state, # Lobby/game message
"IceMsg": GameConnection.handle_ice_message, # Lobby/Game message
"JsonStats": GameConnection.handle_json_stats, # Game message
"LaunchStatus": GameConnection.handle_launch_status, # Lobby message
"OperationComplete": GameConnection.handle_operation_complete, # Coop message
"PlayerOption": GameConnection.handle_player_option, # Lobby message
"Rehost": GameConnection.handle_rehost, # Game message
"TeamkillHappened": GameConnection.handle_teamkill_happened, # Game message
"TeamkillReport": GameConnection.handle_teamkill_report, # Game message
"EstablishedPeers": GameConnection.handle_established_peers, # Game message
}

0 comments on commit aeeb4c2

Please sign in to comment.