Skip to content

Commit 0dceb02

Browse files
GaranasAskaholic
authored andcommitted
Improve documentation of messages
1 parent 645d001 commit 0dceb02

1 file changed

Lines changed: 50 additions & 24 deletions

File tree

server/gameconnection.py

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -509,15 +509,20 @@ async def handle_rehost(self, *args: list[Any]):
509509

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

517520
async def handle_bottleneck(self, *args: list[Any]):
518521
"""
519522
Not sure what this command means. This is currently unused but
520523
included for documentation purposes.
524+
525+
Example args: ["ack", "23381", "232191", "64218.4"]
521526
"""
522527
pass
523528

@@ -547,6 +552,25 @@ async def handle_game_full(self):
547552
"""
548553
pass
549554

555+
async def handle_established_peer(self, peer_id: str):
556+
"""
557+
Sent by the lobby when the player connectes to another peer. Can be
558+
send multiple times.
559+
560+
# Params
561+
- `peer_id`: The identifier of the peer that this connection received
562+
the message from
563+
"""
564+
pass
565+
566+
async def handle_disconnected_peer(self, peer_id: str):
567+
"""
568+
Sent by the lobby when a player disconnects from a peer. This can happen
569+
when a peer is rejoining in which case that peer will have reported a
570+
"Rejoining" status, or if the peer has exited the game.
571+
"""
572+
pass
573+
550574
def _mark_dirty(self):
551575
if self.game:
552576
self.game_service.mark_dirty(self.game)
@@ -623,26 +647,28 @@ def __str__(self):
623647

624648

625649
COMMAND_HANDLERS = {
626-
"AIOption": GameConnection.handle_ai_option,
627-
"Bottleneck": GameConnection.handle_bottleneck,
628-
"BottleneckCleared": GameConnection.handle_bottleneck_cleared,
629-
"Chat": GameConnection.handle_chat,
630-
"ClearSlot": GameConnection.handle_clear_slot,
631-
"Desync": GameConnection.handle_desync,
632-
"Disconnected": GameConnection.handle_disconnected,
633-
"EnforceRating": GameConnection.handle_enforce_rating,
634-
"GameEnded": GameConnection.handle_game_ended,
635-
"GameFull": GameConnection.handle_game_full,
636-
"GameMods": GameConnection.handle_game_mods,
637-
"GameOption": GameConnection.handle_game_option,
638-
"GameResult": GameConnection.handle_game_result,
639-
"GameState": GameConnection.handle_game_state,
640-
"IceMsg": GameConnection.handle_ice_message,
641-
"JsonStats": GameConnection.handle_json_stats,
642-
"LaunchStatus": GameConnection.handle_launch_status,
643-
"OperationComplete": GameConnection.handle_operation_complete,
644-
"PlayerOption": GameConnection.handle_player_option,
645-
"Rehost": GameConnection.handle_rehost,
646-
"TeamkillHappened": GameConnection.handle_teamkill_happened,
647-
"TeamkillReport": GameConnection.handle_teamkill_report,
650+
"AIOption": GameConnection.handle_ai_option, # Lobby message
651+
"Bottleneck": GameConnection.handle_bottleneck, # Lobby/game message
652+
"BottleneckCleared": GameConnection.handle_bottleneck_cleared, # Lobby/game message
653+
"Chat": GameConnection.handle_chat, # Lobby message
654+
"ClearSlot": GameConnection.handle_clear_slot, # Lobby message
655+
"Desync": GameConnection.handle_desync, # Game message
656+
"Disconnected": GameConnection.handle_disconnected, # Lobby message
657+
"EnforceRating": GameConnection.handle_enforce_rating, # Game message
658+
"EstablishedPeer": GameConnection.handle_established_peer, # Lobby message
659+
"DisconnectedPeer": GameConnection.handle_disconnected_peer, # Lobby message
660+
"GameEnded": GameConnection.handle_game_ended, # Game message
661+
"GameFull": GameConnection.handle_game_full, # Lobby message
662+
"GameMods": GameConnection.handle_game_mods, # Lobby message
663+
"GameOption": GameConnection.handle_game_option, # Lobby message
664+
"GameResult": GameConnection.handle_game_result, # Game message
665+
"GameState": GameConnection.handle_game_state, # Lobby/game message
666+
"IceMsg": GameConnection.handle_ice_message, # Lobby/Game message
667+
"JsonStats": GameConnection.handle_json_stats, # Game message
668+
"LaunchStatus": GameConnection.handle_launch_status, # Lobby message
669+
"OperationComplete": GameConnection.handle_operation_complete, # Coop message
670+
"PlayerOption": GameConnection.handle_player_option, # Lobby message
671+
"Rehost": GameConnection.handle_rehost, # Game message
672+
"TeamkillHappened": GameConnection.handle_teamkill_happened, # Game message
673+
"TeamkillReport": GameConnection.handle_teamkill_report, # Game message
648674
}

0 commit comments

Comments
 (0)