From 05bab1d83f0a28c18e78f582fd07fb22439cf3a2 Mon Sep 17 00:00:00 2001 From: "Vgr E. Barry" Date: Thu, 11 Feb 2016 13:55:25 -0500 Subject: [PATCH] Fix ALL THE THINGS --- src/wolfgame.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/wolfgame.py b/src/wolfgame.py index db381c8..24e4f3a 100644 --- a/src/wolfgame.py +++ b/src/wolfgame.py @@ -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)