Added Whisper Command.
Command to allow private speech between players in the same location.
This commit is contained in:
parent
bb027fc208
commit
270a10e8c7
1 changed files with 39 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
||||||
# limit symbol import for API
|
# limit symbol import for API
|
||||||
__all__ = ("CmdHome", "CmdLook", "CmdNick",
|
__all__ = ("CmdHome", "CmdLook", "CmdNick",
|
||||||
"CmdInventory", "CmdGet", "CmdDrop", "CmdGive",
|
"CmdInventory", "CmdGet", "CmdDrop", "CmdGive",
|
||||||
"CmdSay", "CmdPose", "CmdAccess")
|
"CmdSay", "CmdWhisper", "CmdPose", "CmdAccess")
|
||||||
|
|
||||||
|
|
||||||
class CmdHome(COMMAND_DEFAULT_CLASS):
|
class CmdHome(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
@ -417,6 +417,44 @@ class CmdSay(COMMAND_DEFAULT_CLASS):
|
||||||
caller.location.msg_contents(emit_string, exclude=caller, from_obj=caller)
|
caller.location.msg_contents(emit_string, exclude=caller, from_obj=caller)
|
||||||
|
|
||||||
|
|
||||||
|
class CmdWhisper(COMMAND_DEFAULT_CLASS):
|
||||||
|
"""
|
||||||
|
Speak privately as your character to another
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
whisper <player> = <message>
|
||||||
|
|
||||||
|
Talk privately to those in your current location.
|
||||||
|
"""
|
||||||
|
|
||||||
|
key = "whisper"
|
||||||
|
locks = "cmd:all()"
|
||||||
|
|
||||||
|
def func(self):
|
||||||
|
"""Run the whisper command"""
|
||||||
|
|
||||||
|
caller = self.caller
|
||||||
|
|
||||||
|
if not self.lhs or not self.rhs:
|
||||||
|
caller.msg("Usage: whisper <player> = <message>")
|
||||||
|
return
|
||||||
|
|
||||||
|
receiver = caller.search(self.lhs,
|
||||||
|
nofound_string="'%s' cannot be found." % self.lhs)
|
||||||
|
if caller == receiver:
|
||||||
|
caller.msg("You can't whisper yourself.")
|
||||||
|
return
|
||||||
|
|
||||||
|
speech = self.rhs
|
||||||
|
|
||||||
|
# Feedback for the object doing the talking.
|
||||||
|
caller.msg('You whisper %s, "%s|n"' % (receiver.key, speech))
|
||||||
|
|
||||||
|
# Build the string to emit to receiver.
|
||||||
|
emit_string = '%s whispers, "%s|n"' % (caller.name, speech)
|
||||||
|
receiver.msg(emit_string, from_obj=caller)
|
||||||
|
|
||||||
|
|
||||||
class CmdPose(COMMAND_DEFAULT_CLASS):
|
class CmdPose(COMMAND_DEFAULT_CLASS):
|
||||||
"""
|
"""
|
||||||
strike a pose
|
strike a pose
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue