Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.16
1.8.17
2 changes: 1 addition & 1 deletion src/torchlight/CommandHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def HandleCommand(self, line: str, player: Player, from_menu: bool = False
ret = ret_temp
else:
ret = await command._func(message, player)
if from_menu and command.__class__.__name__ in ("VoiceTrigger", "MyInstantsSearch") and ret:
if from_menu and command.echo_from_menu and ret:
self.torchlight.SayChat(f"{{olive}}{player.name}: {{default}}{line}")

except Exception as e:
Expand Down
9 changes: 9 additions & 0 deletions src/torchlight/Commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

class BaseCommand:
order = 0
# Echo the command back to chat when it was triggered from a menu selection.
echo_from_menu = False

def __init__(
self,
Expand Down Expand Up @@ -642,6 +644,8 @@ async def _func(self, message: list[str], player: Player) -> int:


class VoiceTrigger(BaseCommand):
echo_from_menu = True

def _setup(self) -> None:
self.logger.debug(sys._getframe().f_code.co_name)
for trigger in self.trigger_manager.voice_triggers.keys():
Expand Down Expand Up @@ -788,6 +792,9 @@ def get_sound_path(self, player: Player, voice_trigger: str, trigger_number: str


class Random(VoiceTrigger):
# Kept off to preserve the previous exact-class-name behavior; VoiceTrigger enables it.
echo_from_menu = False

def _setup(self) -> None:
self.logger.debug(sys._getframe().f_code.co_name)

Expand Down Expand Up @@ -1447,6 +1454,8 @@ async def _func(self, message: list[str], player: Player) -> int:


class MyInstantsSearch(BaseCommand):
echo_from_menu = True

async def _func(self, message: list[str], player: Player) -> int:
self.logger.debug(sys._getframe().f_code.co_name + " " + str(message))

Expand Down
Loading