Create a command attribute to specify whether messages should be shared between sessions.
This commit is contained in:
parent
af7475c6b9
commit
f538b65279
1 changed files with 4 additions and 2 deletions
|
|
@ -149,6 +149,8 @@ class Command(with_metaclass(CommandMeta, object)):
|
||||||
is_exit = False
|
is_exit = False
|
||||||
# define the command not only by key but by the regex form of its arguments
|
# define the command not only by key but by the regex form of its arguments
|
||||||
arg_regex = None
|
arg_regex = None
|
||||||
|
# whether we share msgs automatically with all sessions
|
||||||
|
share_msgs = False
|
||||||
|
|
||||||
# auto-set (by Evennia on command instantiation) are:
|
# auto-set (by Evennia on command instantiation) are:
|
||||||
# obj - which object this command is defined on
|
# obj - which object this command is defined on
|
||||||
|
|
@ -304,7 +306,7 @@ class Command(with_metaclass(CommandMeta, object)):
|
||||||
"""
|
"""
|
||||||
This is a shortcut instad of calling msg() directly on an
|
This is a shortcut instad of calling msg() directly on an
|
||||||
object - it will detect if caller is an Object or a Player and
|
object - it will detect if caller is an Object or a Player and
|
||||||
also appends self.session automatically.
|
also appends self.session automatically if self.share_msgs is False.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text (str, optional): Text string of message to send.
|
text (str, optional): Text string of message to send.
|
||||||
|
|
@ -321,7 +323,7 @@ class Command(with_metaclass(CommandMeta, object)):
|
||||||
"""
|
"""
|
||||||
from_obj = from_obj or self.caller
|
from_obj = from_obj or self.caller
|
||||||
to_obj = to_obj or from_obj
|
to_obj = to_obj or from_obj
|
||||||
if not session:
|
if not session and not self.share_msgs:
|
||||||
if to_obj == self.caller:
|
if to_obj == self.caller:
|
||||||
session = self.session
|
session = self.session
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue