From ee3705cb816b5e984db42dac6bedbaf95358bfa5 Mon Sep 17 00:00:00 2001 From: Andrew Bastien Date: Fri, 24 Nov 2023 14:48:04 -0500 Subject: [PATCH] Commands now have a .cmdset_source pointing at their original cmdset instance. --- evennia/commands/cmdset.py | 2 ++ evennia/commands/command.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/evennia/commands/cmdset.py b/evennia/commands/cmdset.py index f61dd3b768..618d78cfad 100644 --- a/evennia/commands/cmdset.py +++ b/evennia/commands/cmdset.py @@ -541,6 +541,8 @@ class CmdSet(object, metaclass=_CmdSetMeta): system_commands = self.system_commands for cmd in cmds: + # Ensure commands know their source cmdset. + cmd.cmdset_source = self # add all commands if not hasattr(cmd, "obj") or cmd.obj is None: cmd.obj = self.cmdsetobj diff --git a/evennia/commands/command.py b/evennia/commands/command.py index 9368381ef0..8d3cbb7be3 100644 --- a/evennia/commands/command.py +++ b/evennia/commands/command.py @@ -156,9 +156,10 @@ class Command(metaclass=CommandMeta): you to know which alias was used, for example) self.args - everything supplied to the command following the cmdstring (this is usually what is parsed in self.parse()) - self.cmdset - the cmdset from which this command was matched (useful only + self.cmdset - the merged cmdset from which this command was matched (useful only seldomly, notably for help-type commands, to create dynamic help entries and lists) + self.cmdset_source - the specific cmdset this command was matched from. self.obj - the object on which this command is defined. If a default command, this is usually the same as caller. self.raw_string - the full raw string input, including the command name,