From ff2321269c13b87cbe9db0ca734d5e9a1d315f15 Mon Sep 17 00:00:00 2001 From: cmyui Date: Sun, 26 May 2024 14:04:43 -0400 Subject: [PATCH] Match bancho.py's handling of !mp start force --- constants/chatbotCommands.py | 4 +--- objects/match.py | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/constants/chatbotCommands.py b/constants/chatbotCommands.py index 65c1a528..6f04d0d7 100644 --- a/constants/chatbotCommands.py +++ b/constants/chatbotCommands.py @@ -1861,11 +1861,9 @@ async def _decreaseTimer(t: int) -> None: slots = await slot.get_slots(multiplayer_match["match_id"]) assert len(slots) == 16 - for slot_id, _slot in enumerate(slots): + for _slot in slots: if _slot["status"] != slotStatuses.READY and _slot["user_token"]: someoneNotReady = True - if force: - await match.toggleSlotReady(multiplayer_match["match_id"], slot_id) if someoneNotReady and not force: return ( diff --git a/objects/match.py b/objects/match.py index 5dc031c3..343501fd 100644 --- a/objects/match.py +++ b/objects/match.py @@ -1300,12 +1300,13 @@ async def start(match_id: int) -> bool: slots = await slot.get_slots(match_id) assert len(slots) == 16 + playing_token_ids: list[str] = [] for slot_id, _slot in enumerate(slots): if _slot["user_token"] is None: continue user_token = await osuToken.get_token(_slot["user_token"]) - if user_token is not None: + if user_token is not None and _slot["status"] != slotStatuses.NO_MAP: await slot.update_slot( match_id, slot_id, @@ -1316,11 +1317,13 @@ async def start(match_id: int) -> bool: ) await osuToken.joinStream(user_token["token_id"], playing_stream_name) + playing_token_ids.append(user_token["token_id"]) # Send match start packet - await streamList.broadcast( + await streamList.multicast( playing_stream_name, await serverPackets.matchStart(match_id), + recipient_token_ids=playing_token_ids, ) game_id = await insert_match_game(