From a0e746bcba00a4c877480f3ea6e8a64d0e9654ca Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Sun, 8 Jun 2025 21:22:51 -0700 Subject: [PATCH] English is hard. Fix $pron() to take 'op' --- typeclasses/characters.py | 7 +++++-- typeclasses/pets.py | 14 ++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/typeclasses/characters.py b/typeclasses/characters.py index ae1468b..994d567 100644 --- a/typeclasses/characters.py +++ b/typeclasses/characters.py @@ -303,8 +303,11 @@ class Character(Object, GenderCharacter, ContribRPCharacter): """ Replaces a location's 'msg_contents' with an emote. """ - # All this does is add the character's gender to the message: - newmsg = sub(r"\$pron\((.*?)\)", f"$pron(\\1, {self.db.gender})", message) + # All this does is add the character's gender to the message. + # So $pron(you,op) will render "you" or "him" + newmsg = sub(r"\$pron\((.*?),(.*?)\)", f"$pron(\\1,\\2 {self.db.gender})", message) + # While $pron(you) will render "you" and "he": + newmsg = sub(r"\$pron\(([^,]*?)\)", f"$pron(\\1, {self.db.gender})", newmsg) choose = choices(newmsg) logger.info(choose) self.location.msg_contents(f"{choose}", from_obj=self, exclude=exclude) diff --git a/typeclasses/pets.py b/typeclasses/pets.py index b08516f..d084f79 100755 --- a/typeclasses/pets.py +++ b/typeclasses/pets.py @@ -532,24 +532,26 @@ class BHB(Friendly): case Reaction.INTERESTED: how_sniff = "curiously" how_eat = "quickly" - and_then = "waits to see what else you might have" + and_then = "waits to see what else $you() might have" case _: how_sniff = "eagerly" how_eat = "excitedly" - and_then = "gives you a big lick as if to say, Thank you" + and_then = "gives $pron(you,op) a big lick as if to say, Thank you" if is_scone(item): - msg = f"{noun} {how_sniff} sniffs your outstretched arm holding the scone. It {how_eat} eats it, and {and_then}." + msg = f"{noun} {how_sniff} sniffs $your() outstretched arm holding a scone. It {how_eat} eats it, and {and_then}." self.adjust_character(feeder, 100) feeder.has('scone').delete() elif is_berry(item): - msg = f"{noun} {how_sniff} sniffs your outstretched arm with a handful of berries. It {how_eat} eats them, and {and_then}." + msg = f"{noun} {how_sniff} sniffs $your() outstretched arm with a handful of berries. It {how_eat} eats them, and {and_then}." self.adjust_character(feeder, 40) feeder.has('berries').delete() else: msg = f"{noun} doesn't appear interested in anything you have." - feeder.msg(msg) + if msg: + feeder.announce_action(msg) + # feeder.msg(msg) def thrown_stick(self, thrower): """ @@ -560,7 +562,7 @@ class BHB(Friendly): case Reaction.SCARED: msg = "The beast runs away when $you() throw the stick." case Reaction.CONCERNED: - msg = "The beast walks over to the stick, sniffs it, and backs away." + msg = "The beast walks over to the stick $you() threw, sniffs it, and backs away." self.adjust_character(thrower, 5) case Reaction.INTERESTED: msg = choices("""