Fix merge conflicts with say-branch

This commit is contained in:
Griatch 2017-07-21 11:06:38 +02:00
commit 8600e8c546
3 changed files with 152 additions and 26 deletions

View file

@ -409,17 +409,15 @@ class CmdSay(COMMAND_DEFAULT_CLASS):
speech = self.args
# calling the speech hook on the location
speech = caller.location.at_say(caller, speech)
# Calling the at_before_say hook on the character
speech = caller.at_before_say(speech)
# Feedback for the object doing the talking.
caller.msg('You say, "%s|n"' % speech)
# Build the string to emit to neighbors.
emit_string = '%s says, "%s|n"' % (caller.name, speech)
caller.location.msg_contents(text=(emit_string, {"type": "say"}),
exclude=caller, from_obj=caller)
# If speech is empty, stop here
if not speech:
return
# Call the at_after_say hook on the character
caller.at_after_say(speech)
class CmdWhisper(COMMAND_DEFAULT_CLASS):
"""
@ -454,13 +452,15 @@ class CmdWhisper(COMMAND_DEFAULT_CLASS):
return
speech = self.rhs
# Call a hook to change the speech before whispering
speech = caller.at_before_whisper(receiver, speech)
# Feedback for the object doing the talking.
caller.msg('You whisper to %s, "%s|n"' % (receiver.key, speech))
# If the speech is empty, abort the command
if not speech:
return
# Build the string to emit to receiver.
emit_string = '%s whispers, "%s|n"' % (caller.name, speech)
receiver.msg(text=(emit_string, {"type": "whisper"}), from_obj=caller)
# Call the at_after_whisper hook for feedback
caller.at_after_whisper(receiver, speech)
class CmdPose(COMMAND_DEFAULT_CLASS):

View file

@ -131,7 +131,7 @@ class TestGeneral(CommandTest):
self.call(general.CmdSay(), "Testing", "You say, \"Testing\"")
def test_whisper(self):
self.call(general.CmdWhisper(), "Obj = Testing", "You whisper to Obj, \"Testing\"")
self.call(general.CmdWhisper(), "Obj = Testing", "You whisper to Obj, \"Testing\"", caller=self.char2)
def test_access(self):
self.call(general.CmdAccess(), "", "Permission Hierarchy (climbing):")