Add more flexibility to the hooks on say

This commit is contained in:
Vincent Le Goff 2017-03-28 11:23:32 -07:00
parent 21e72e416c
commit f11e92b2c0
2 changed files with 80 additions and 8 deletions

View file

@ -409,16 +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(emit_string, 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):
"""