show which players are missing, which is usually the important bit
This commit is contained in:
parent
a29f93045e
commit
8f37715541
|
@ -192,19 +192,21 @@ async def countdown(ctx: Context, timer):
|
||||||
notify_all(ctx, f'[Server]: GO')
|
notify_all(ctx, f'[Server]: GO')
|
||||||
|
|
||||||
def get_connected_players_string(ctx: Context):
|
def get_connected_players_string(ctx: Context):
|
||||||
auth_clients = [c for c in ctx.clients if c.auth]
|
auth_clients = {(c.team, c.slot) for c in ctx.clients if c.auth}
|
||||||
if not auth_clients:
|
|
||||||
return f'No player connected, of {len(ctx.player_names)} expected players'
|
|
||||||
|
|
||||||
auth_clients.sort(key=lambda c: (c.team, c.slot))
|
player_names = sorted(ctx.player_names.keys())
|
||||||
current_team = -1
|
current_team = -1
|
||||||
text = ''
|
text = ''
|
||||||
for c in auth_clients:
|
for team, slot in player_names:
|
||||||
if c.team != current_team:
|
player_name = ctx.player_names[team, slot]
|
||||||
text += f':: Team #{c.team + 1}: '
|
if team != current_team:
|
||||||
current_team = c.team
|
text += f':: Team #{team + 1}: '
|
||||||
text += f'{c.name} '
|
current_team = team
|
||||||
return f'Connected players ({len(auth_clients)} of {len(ctx.player_names)}) ' + text[:-1]
|
if (team, slot) in auth_clients:
|
||||||
|
text += f'{player_name} '
|
||||||
|
else:
|
||||||
|
text += f'({player_name}) '
|
||||||
|
return f'{len(auth_clients)} players of {len(ctx.player_names)} connected ' + text[:-1]
|
||||||
|
|
||||||
|
|
||||||
def get_received_items(ctx: Context, team: int, player: int):
|
def get_received_items(ctx: Context, team: int, player: int):
|
||||||
|
|
Loading…
Reference in New Issue