Add short day settings.

This makes the games go slightly faster when there are fewer players
This commit is contained in:
Eitan Adler 2013-04-13 23:15:27 -04:00
parent eef1d2cd95
commit 6239b31a71
2 changed files with 12 additions and 2 deletions

View File

@ -561,7 +561,10 @@ def hurry_up(cli, gameid, change):
"are no votes or an even split.\02"))
if not var.DAY_TIME_LIMIT_CHANGE:
return
tmr = threading.Timer(var.DAY_TIME_LIMIT_CHANGE, hurry_up, [cli, var.DAY_ID, True])
if (len(var.list_players()) <= var.SHORT_DAY_PLAYERS):
tmr = threading.Timer(var.SHORT_DAY_LIMIT_CHANGE, hurry_up, [cli, var.DAY_ID, True])
else:
tmr = threading.Timer(var.DAY_TIME_LIMIT_CHANGE, hurry_up, [cli, var.DAY_ID, True])
tmr.daemon = True
var.TIMERS["day"] = tmr
tmr.start()
@ -1231,7 +1234,10 @@ def begin_day(cli):
if var.DAY_TIME_LIMIT_WARN > 0: # Time limit enabled
var.DAY_ID = time.time()
t = threading.Timer(var.DAY_TIME_LIMIT_WARN, hurry_up, [cli, var.DAY_ID, False])
if len(var.list_players()) <= var.SHORT_DAY_PLAYERS:
t = threading.Timer(var.SHORT_DAY_LIMIT_WARN, hurry_up, [cli, var.DAY_ID, False])
else:
t = threading.Timer(var.DAY_TIME_LIMIT_WARN, hurry_up, [cli, var.DAY_ID, False])
var.TIMERS["day_warn"] = t
t.daemon = True
t.start()

View File

@ -13,6 +13,10 @@ NIGHT_TIME_LIMIT = 120
NIGHT_TIME_WARN = 0 # should be less than NIGHT_TIME_LIMIT
DAY_TIME_LIMIT_WARN = 600
DAY_TIME_LIMIT_CHANGE = 120 # seconds after DAY_TIME_LIMIT_WARN has passed
# May only be set if the above are also set
SHORT_DAY_PLAYERS = 6 # Number of players left to have a short day
SHORT_DAY_LIMT_WARN = 400
SHORT_DAY_LIMIT_CHANGE = 120
KILL_IDLE_TIME = 300
WARN_IDLE_TIME = 180
PART_GRACE_TIME = 7