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

Match bancho.py's handling of !mp start force #144

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions constants/chatbotCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
7 changes: 5 additions & 2 deletions objects/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is gonna need reworking with the new broadcast_data method since it takes exclusion and not inclusion

)

game_id = await insert_match_game(
Expand Down