From 9424acf85bd3a5c0f04eaf425d47bbe73aefe02e Mon Sep 17 00:00:00 2001 From: "(Jip) Willem Wijnia" Date: Sat, 26 Oct 2024 15:58:09 +0200 Subject: [PATCH] Improve documentation of messages --- server/gameconnection.py | 86 +++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 24 deletions(-) diff --git a/server/gameconnection.py b/server/gameconnection.py index 6d2e10c87..c25c8b6a0 100644 --- a/server/gameconnection.py +++ b/server/gameconnection.py @@ -509,9 +509,33 @@ 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. """ + + if status == "Unknown": + pass + + if status == "Connecting": + pass + + elif status == "Missing local peers": + pass + + elif status == "Rejoining": + pass + + elif status == "Ready": + pass + + elif status == "Ejected": + pass + + elif status == "Rejected": + pass + + elif status == 'Failed': + pass + pass async def handle_bottleneck(self, *args: list[Any]): @@ -547,6 +571,19 @@ async def handle_game_full(self): """ pass + async def handle_established_peers(self, peerId: str, peerConnectedTo:str): + """ + Send by the lobby when a peer connected to another peer. Message can be send multiple times, by multiple connections. + + # Params + - peerId: The identifier of the peer that this connection received the message from + - peerConneectedTo: 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" + """ + + peerConnectedToList = peerConnectedTo.split(" ") + + pass + def _mark_dirty(self): if self.game: self.game_service.mark_dirty(self.game) @@ -623,26 +660,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 }