From d769943c0a1819ce7e35ac78f04ce8d502a927c0 Mon Sep 17 00:00:00 2001 From: xnrand Date: Mon, 17 Feb 2014 04:47:53 +0100 Subject: [PATCH] Add feature for wait time added for each !join Ineffective by default because the wait time is set to 0 in the default configuration file. --- modules/wolfgame.py | 9 ++++++++- settings/wolfgame.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 84caf78..19311a7 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -420,9 +420,16 @@ def join(cli, nick, chann_, rest): var.ROLES["person"].append(nick) cli.msg(chan, '\u0002{0}\u0002 has joined the game and raised the number of players to \u0002{1}\u0002.'.format(nick, len(pl) + 1)) if not cloak in var.JOINED_THIS_GAME: - # make sure this only happens one + # make sure this only happens once var.JOINED_THIS_GAME.append(cloak) now = datetime.now() + + # add var.EXTRA_WAIT_JOIN to wait time + if now > var.CAN_START_TIME: + var.CAN_START_TIME = now + timedelta(seconds=var.EXTRA_WAIT_JOIN) + else: + var.CAN_START_TIME += timedelta(seconds=var.EXTRA_WAIT_JOIN) + # make sure there's at least var.WAIT_AFTER_JOIN seconds of wait time left, if not add them if now + timedelta(seconds=var.WAIT_AFTER_JOIN) > var.CAN_START_TIME: var.CAN_START_TIME = now + timedelta(seconds=var.WAIT_AFTER_JOIN) diff --git a/settings/wolfgame.py b/settings/wolfgame.py index 3b7197c..3c445db 100644 --- a/settings/wolfgame.py +++ b/settings/wolfgame.py @@ -2,6 +2,7 @@ PING_WAIT = 300 # Seconds PING_MIN_WAIT = 30 # How long !start has to wait after a !ping MINIMUM_WAIT = 60 EXTRA_WAIT = 20 +EXTRA_WAIT_JOIN = 0 # Add this many seconds to the waiting time for each !join WAIT_AFTER_JOIN = 10 # Wait at least this many seconds after the last join MAXIMUM_WAITED = 3 # limit for amount of !wait's STATS_RATE_LIMIT = 60