Skip to content

Commit

Permalink
Fix dead VG regaining voice when doing !swap, fixes #523
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed May 1, 2024
1 parent 98178e8 commit 3be59f7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/wolfgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,20 +339,21 @@ def replace(wrapper: MessageDispatcher, message: str):

var = wrapper.game_state

if wrapper.source in get_players(var):
pl = get_players(var)
if wrapper.source in pl:
wrapper.pm(messages["you_already_playing"])
return

if not wrapper.source.account:
wrapper.pm(messages["not_logged_in"])
return

pl = get_participants(var)
participants = get_participants(var)
target: Optional[User] = None

for user in var.players:
if context.equals(user.account, wrapper.source.account):
if user is wrapper.source or user not in pl:
if user is wrapper.source or user not in participants:
continue
elif target is None:
target = user
Expand All @@ -370,7 +371,7 @@ def replace(wrapper: MessageDispatcher, message: str):

cmodes = []

if config.Main.get("gameplay.nightchat") or var.current_phase != "night":
if (config.Main.get("gameplay.nightchat") or var.current_phase != "night") and target in pl:
cmodes += [("-v", target), ("+v", wrapper.source)]

toggle_modes = config.Main.get("transports[0].channels.main.auto_mode_toggle", ())
Expand Down

0 comments on commit 3be59f7

Please sign in to comment.