Fix ALL THE THINGS

This commit is contained in:
Vgr E. Barry 2016-02-11 13:55:25 -05:00
parent fb3e7eb8b6
commit 05bab1d83f

View File

@ -3460,18 +3460,19 @@ def rename_player(cli, prefix, nick):
event = Event("rename_player", {})
event.dispatch(cli, var, prefix, nick)
if prefix in var.list_players():
r = var.ROLES[var.get_role(prefix)]
r.add(nick)
r.remove(prefix)
tpls = var.get_templates(prefix)
for t in tpls:
var.ROLES[t].add(nick)
var.ROLES[t].remove(prefix)
if prefix in var.ALL_PLAYERS:
pl = var.list_players()
if prefix in pl:
r = var.ROLES[var.get_role(prefix)]
r.add(nick)
r.remove(prefix)
tpls = var.get_templates(prefix)
for t in tpls:
var.ROLES[t].add(nick)
var.ROLES[t].remove(prefix)
if prefix in var.ALL_PLAYERS:
# ALL_PLAYERS needs to keep its ordering for purposes of mad scientist
var.ALL_PLAYERS[var.ALL_PLAYERS.index(prefix)] = nick
# ALL_PLAYERS needs to keep its ordering for purposes of mad scientist
var.ALL_PLAYERS[var.ALL_PLAYERS.index(prefix)] = nick
if var.PHASE in ("night", "day"):
for k,v in var.ORIGINAL_ROLES.items():
@ -3620,10 +3621,6 @@ def rename_player(cli, prefix, nick):
var.START_VOTES.discard(prefix)
var.START_VOTES.add(nick)
elif prefix in var.ALL_PLAYERS:
# this needs updating after death to disallow epic breakages
var.ALL_PLAYERS[var.ALL_PLAYERS.index(prefix)] = nick
# Check if player was disconnected
if var.PHASE in ("night", "day"):
return_to_village(cli, chan, nick, True)