diff --git a/evennia/commands/command.py b/evennia/commands/command.py index e9de208bde..79c6b48ce7 100644 --- a/evennia/commands/command.py +++ b/evennia/commands/command.py @@ -143,17 +143,18 @@ class Command(with_metaclass(CommandMeta, object)): aliases = [] # a list of lock definitions on the form # cmd:[NOT] func(args) [ AND|OR][ NOT] func2(args) - locks = settings.DEFAULT_COMMAND_LOCKS + locks = settings.COMMAND_DEFAULT_LOCKS # used by the help system to group commands in lists. - help_category = settings.DEFAULT_COMMAND_HELP_CATEGORY + help_category = settings.COMMAND_DEFAULT_HELP_CATEGORY # This allows to turn off auto-help entry creation for individual commands. auto_help = True # optimization for quickly separating exit-commands from normal commands is_exit = False # define the command not only by key but by the regex form of its arguments - arg_regex = settings.DEFAULT_COMMAND_ARG_REGEX - # whether we share msgs automatically with all sessions - share_msgs = settings.DEFAULT_COMMAND_MSG_SHARE + arg_regex = settings.COMMAND_DEFAULT_ARG_REGEX + # whether self.msg sends to all sessions of a related player/object (default + # is to only send to the session sending the command). + msg_all_sessions = settings.COMMAND_DEFAULT_MSG_ALL_SESSIONS # auto-set (by Evennia on command instantiation) are: # obj - which object this command is defined on @@ -309,14 +310,14 @@ class Command(with_metaclass(CommandMeta, object)): """ This is a shortcut instad of calling msg() directly on an object - it will detect if caller is an Object or a Player and - also appends self.session automatically if self.share_msgs is False. + also appends self.session automatically if self.msg_all_sessions is False. Args: text (str, optional): Text string of message to send. to_obj (Object, optional): Target object of message. Defaults to self.caller. from_obj (Object, optional): Source of message. Defaults to to_obj. session (Session, optional): Supply data only to a unique - session. + session (ignores the value of `self.msg_all_sessions`). Kwargs: options (dict): Options to the protocol. @@ -326,7 +327,7 @@ class Command(with_metaclass(CommandMeta, object)): """ from_obj = from_obj or self.caller to_obj = to_obj or from_obj - if not session and not self.share_msgs: + if not session and not self.msg_all_sessions: if to_obj == self.caller: session = self.session else: diff --git a/evennia/settings_default.py b/evennia/settings_default.py index 57a29ab35c..3159eb9122 100644 --- a/evennia/settings_default.py +++ b/evennia/settings_default.py @@ -342,24 +342,26 @@ CMDSET_PATHS = ["commands", "evennia", "contribs"] # Parent class for all default commands. Changing this class will # modify all default commands, so do so carefully. COMMAND_DEFAULT_CLASS = "evennia.commands.default.muxcommand.MuxCommand" +# Command.arg_regex is a regular expression desribing how the arguments +# to the command must be structured for the command to match a given user +# input. By default there is no restriction as long as the input string +# starts with the command name. +COMMAND_DEFAULT_ARG_REGEX = None +# By default, Command.msg will only send data to the Session calling +# the Command in the first place. If set, Command.msg will instead return +# data to all Sessions connected to the Player/Character associated with +# calling the Command. This may be more intuitive for users in certain +# multisession modes. +COMMAND_DEFAULT_MSG_ALL_SESSIONS = False +# The help category of a command if not otherwise specified. +COMMAND_DEFAULT_HELP_CATEGORY = "general" +# The default lockstring of a command. +COMMAND_DEFAULT_LOCKS = "" # The Channel Handler will create a command to represent each channel, # creating it with the key of the channel, its aliases, locks etc. The # default class logs channel messages to a file and allows for /history. # This setting allows to override the command class used with your own. CHANNEL_COMMAND_CLASS = "evennia.comms.channelhandler.ChannelCommand" -# These specify defaults to the base Command parent class. Override them -# in order to change default behavior for your commands. -# If specified, DEFAULT_COMMAND_ARG_REGEX forces a command's structure -# to match the given regular expression. -DEFAULT_COMMAND_ARG_REGEX = None -# If True, DEFAULT_COMMAND_MSG_SHARE will share a self.msg() to all sessions -# associated with the caller. -# If False, self.msg() will send a message only self.session. -DEFAULT_COMMAND_MSG_SHARE = False -# The help category of a command if not otherwise specified. -DEFAULT_COMMAND_HELP_CATEGORY = "general" -# The default lockstring of a command. -DEFAULT_COMMAND_LOCKS = "" ###################################################################### # Typeclasses and other paths