Browse Source

prevent certain debug mode crashes

master
jcao219 13 years ago
parent
commit
c2be01dc94
  1. 2
      modules/common.py
  2. 5
      modules/wolfgame.py

2
modules/common.py

@ -111,7 +111,7 @@ def connect_callback(cli):
if botconfig.JOIN_AFTER_CLOAKED: if botconfig.JOIN_AFTER_CLOAKED:
prepare_stuff = hook("event_hosthidden", hookid=294)(prepare_stuff) prepare_stuff = hook("event_hosthidden", hookid=294)(prepare_stuff)
else: else:
prepare_stuff = hook("event_hosthidden", hookid=294)(prepare_stuff) prepare_stuff = hook("endofmotd", hookid=294)(prepare_stuff)
@hook("mode") @hook("mode")
def check_if_identified(cli, spam, egg, m, *etc): def check_if_identified(cli, spam, egg, m, *etc):

5
modules/wolfgame.py

@ -59,6 +59,7 @@ var.ORIGINAL_SETTINGS = {}
var.LAST_SAID_TIME = {} var.LAST_SAID_TIME = {}
var.GAME_START_TIME = datetime.now() # for idle checker only var.GAME_START_TIME = datetime.now() # for idle checker only
var.CAN_START_TIME = 0
var.GRAVEYARD_LOCK = threading.RLock() var.GRAVEYARD_LOCK = threading.RLock()
var.GAME_ID = 0 var.GAME_ID = 0
@ -280,7 +281,7 @@ def pinger(cli, nick, chan, rest):
var.PINGING = False var.PINGING = False
minimum = datetime.now() + timedelta(seconds=var.PING_MIN_WAIT) minimum = datetime.now() + timedelta(seconds=var.PING_MIN_WAIT)
if var.CAN_START_TIME < minimum: if not var.CAN_START_TIME or var.CAN_START_TIME < minimum:
var.CAN_START_TIME = minimum var.CAN_START_TIME = minimum
decorators.unhook(HOOKS, 800) decorators.unhook(HOOKS, 800)
@ -1543,7 +1544,7 @@ def shoot(cli, nick, chann_, rest):
wolfshooter = nick in var.ROLES["wolf"]+var.ROLES["werecrow"]+var.ROLES["traitor"] wolfshooter = nick in var.ROLES["wolf"]+var.ROLES["werecrow"]+var.ROLES["traitor"]
if wolfshooter: if wolfshooter and nick in var.WOLF_GUNNERS:
var.WOLF_GUNNERS[nick] -= 1 var.WOLF_GUNNERS[nick] -= 1
else: else:
var.GUNNERS[nick] -= 1 var.GUNNERS[nick] -= 1

Loading…
Cancel
Save