Browse Source

added a warning for the sunset feature

master
jcao219 13 years ago
parent
commit
14ca6c49b0
  1. 3
      var.py
  2. 26
      wolfgame.py

3
var.py

@ -6,7 +6,8 @@ SHOTS_MULTIPLIER = .12 # ceil(shots_multiplier * len_players) = bullets given @@ -6,7 +6,8 @@ SHOTS_MULTIPLIER = .12 # ceil(shots_multiplier * len_players) = bullets given
MAX_PLAYERS = 30
DRUNK_SHOTS_MULTIPLIER = 3
NIGHT_TIME_LIMIT = 90
DAY_TIME_LIMIT = 0
DAY_TIME_LIMIT_WARN = 780
DAY_TIME_LIMIT_CHANGE = 900
START_WITH_DAY = False
KILL_IDLE_TIME = 300
WARN_IDLE_TIME = 180

26
wolfgame.py

@ -422,14 +422,26 @@ def stats(cli, nick, chan, rest): @@ -422,14 +422,26 @@ def stats(cli, nick, chan, rest):
def hurry_up(cli, gameid=0):
def hurry_up(cli, gameid, change):
if var.PHASE != "day": return
if gameid:
if gameid != var.DAY_ID:
return
var.DAY_ID = 0
chan = botconfig.CHANNEL
if not change:
cli.msg(chan, "The sun is almost setting.")
if not var.DAY_TIME_LIMIT_CHANGE:
return
var.TIMERS[1] = threading.Timer(var.DAY_TIME_LIMIT_CHANGE, hurry_up, [cli, var.DAY_ID, True])
var.TIMERS[1].daemon = True
var.TIMERS[1].start()
return
var.DAY_ID = 0
pl = var.list_players()
avail = len(pl) - len(var.WOUNDED)
votesneeded = avail // 2 + 1
@ -462,7 +474,7 @@ def fnight(cli, nick, chan, rest): @@ -462,7 +474,7 @@ def fnight(cli, nick, chan, rest):
if var.PHASE != "day":
cli.notice(nick, "It is not daytime.")
else:
hurry_up(cli)
hurry_up(cli, 0, True)
@cmd("fday", admin_only=True)
@ -969,9 +981,9 @@ def begin_day(cli): @@ -969,9 +981,9 @@ def begin_day(cli):
var.LOGGER.logMessage(msg)
var.LOGGER.logBare("DAY", "BEGIN")
if var.DAY_TIME_LIMIT > 0: # Time limit enabled
if var.DAY_TIME_LIMIT_WARN > 0: # Time limit enabled
var.DAY_ID = timetime()
t = threading.Timer(var.DAY_TIME_LIMIT, hurry_up, [cli, var.DAY_ID])
t = threading.Timer(var.DAY_TIME_LIMIT_WARN, hurry_up, [cli, var.DAY_ID, False])
var.TIMERS[1] = t
var.TIMERS[1].daemon = True
t.start()
@ -1707,9 +1719,9 @@ def transition_night(cli): @@ -1707,9 +1719,9 @@ def transition_night(cli):
dmsg = (daydur_msg + "It is now nighttime. All players "+
"check for PMs from me for instructions. "+
"If you did not receive one, simply sit back, "+
"relax, and wait patiently for morning.").replace("\02", "")
"relax, and wait patiently for morning.")
cli.msg(chan, dmsg)
var.LOGGER.logMessage(dmsg)
var.LOGGER.logMessage(dmsg.replace("\02", ""))
var.LOGGER.logBare("NIGHT", "BEGIN")
# cli.msg(chan, "DEBUG: "+str(var.ROLES))

Loading…
Cancel
Save