Fix bug in 'say' when 'to' doesn't match
This commit is contained in:
parent
e3e87f3ec9
commit
2994ecf255
1 changed files with 11 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ from evennia.contrib.rpg.rpsystem import send_emote
|
|||
from evennia.utils import iter_to_str, logger
|
||||
|
||||
from typeclasses.readables import find_book
|
||||
from typeclasses.characters import Character
|
||||
from utils.word_list import routput, paragraph, choices
|
||||
|
||||
def speech_effect(speech, verb, target, effects):
|
||||
|
|
@ -185,13 +186,21 @@ class CmdSay(MuxCommand):
|
|||
# Send the message to 'puppets' that have the special 'other_sayto'
|
||||
# method (if they are the object of the message):
|
||||
targets = split(r" *, *", self.lhs)
|
||||
to_chars = [speaker.search(c, quiet=True)[0] for c in targets]
|
||||
to_chars = [speaker.search(c, quiet=True) for c in targets]
|
||||
to_chars = [c[0] for c in to_chars if len(c) > 0]
|
||||
|
||||
if to_chars == []:
|
||||
speaker.msg(f"No match for {', '.join(targets)}")
|
||||
return
|
||||
|
||||
for char in to_chars:
|
||||
if hasattr(char, 'other_sayto') and callable(char.other_sayto):
|
||||
logger.info(f"Found {char.key}: {for_others}")
|
||||
char.other_sayto(speaker, for_others)
|
||||
|
||||
who = iter_to_str([c.get_display_name(speaker) for c in to_chars])
|
||||
who = iter_to_str([c.get_display_name(speaker)
|
||||
if isinstance(c, Character) else c
|
||||
for c in to_chars])
|
||||
whom = iter_to_str([f"/{c}" for c in targets])
|
||||
|
||||
if verb == "ask":
|
||||
|
|
|
|||
Loading…
Reference in a new issue