From 2c8d4e550ccb25d552f0c3bbad7a04a84fb01675 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Wed, 11 Mar 2020 23:08:16 +0100 Subject: [PATCH] restruct countdown command --- MultiServer.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index fc1037ad..e6ee3b8b 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -181,15 +181,14 @@ async def on_client_left(ctx: Context, client: Client): async def countdown(ctx: Context, timer): notify_all(ctx, f'[Server]: Starting countdown of {timer}s') if ctx.countdown_timer: + ctx.countdown_timer = timer # timer is already running, set it to a different time + else: ctx.countdown_timer = timer - return - - ctx.countdown_timer = timer - while ctx.countdown_timer > 0: - notify_all(ctx, f'[Server]: {ctx.countdown_timer}') - ctx.countdown_timer -= 1 - await asyncio.sleep(1) - notify_all(ctx, f'[Server]: GO') + while ctx.countdown_timer > 0: + notify_all(ctx, f'[Server]: {ctx.countdown_timer}') + ctx.countdown_timer -= 1 + await asyncio.sleep(1) + notify_all(ctx, f'[Server]: GO') def get_connected_players_string(ctx: Context): auth_clients = {(c.team, c.slot) for c in ctx.clients if c.auth}