diff --git a/typeclasses/puppets.py b/typeclasses/puppets.py index 442178e..e0af89a 100755 --- a/typeclasses/puppets.py +++ b/typeclasses/puppets.py @@ -1,8 +1,11 @@ #!/usr/bin/env python from re import split, match, IGNORECASE + +from evennia import CmdSet from evennia.utils import logger +from commands.command import Command from typeclasses.characters import Character from utils.word_list import routput @@ -130,3 +133,35 @@ class Puppet(Character): def other_given(self, giver, obj): target = giver.get_display_name(self).split(' ')[-1] self.execute_cmd(f"emote /Me says to /{target}, \"Thanks for the {obj.name}.\"") + + +class CmdShrubSay(Command): + """Erase and write on the shrub's chalkboard. + """ + key = "say" + locks = "cmd:holds()" + priority = 5 + + def func(self): + here = self.caller.location + msg = routput("The shrub uses a branch to << brush ^ wipe >> << off ^ >> << the chalk from ^ >> its << small ^ >> chalkboard, and with another branch, << slowly ^ carefully ^ deliberately ^ >> starts to write << something ^ a message ^ >>.") + here.msg_contents(msg) + self.caller.db.inside = self.args.strip() + + +class CmdSetShrubSay(CmdSet): + """ + The shrub's version of the 'say' command. + """ + def at_cmdset_creation(self): + super().at_cmdset_creation() + self.add(CmdShrubSay) + + +class Shrub(Puppet): + """ + The 'Shrub' has its own way of communicating. + """ + def at_object_creation(self): + "Called when a character is first created." + self.cmdset.add(CmdSetShrubSay, persistent=True) diff --git a/world/version2.ev b/world/version2.ev index 3e27efd..6cd86b9 100644 --- a/world/version2.ev +++ b/world/version2.ev @@ -191,7 +191,7 @@ py bt = self.search('pixies'); bt.db.pose_default = 'playing music atop a giant # [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:1]] -@create/drop shrub;bush;chalkboard;awakened shrub: typeclasses.puppets.Puppet +@create/drop shrub;bush;chalkboard;awakened shrub: typeclasses.puppets.Shrub # Awakened Shrub:1 ends here @@ -200,9 +200,7 @@ py bt = self.search('pixies'); bt.db.pose_default = 'playing music atop a giant # [[file:../../../projects/mud-rpg.org::*Awakened Shrub][Awakened Shrub:2]] -@desc shrub = If a small shrub had the facial muscles to smile and show how much it enjoys itself, this lil' guy would be it. The short leaves indicates it once was a boxwood, but the way it nurses that glass of water shows those days are way behind. When you look its way, it waves a branch at you. - -You notice one of its branches clutch a small chalkboard while another holds a piece of chalk. +@desc shrub = If a small shrub had the facial muscles to smile and show how much it enjoys itself, this lil' guy would be it. The short leaves indicates it once was a boxwood, but the way it nurses that glass of water shows those days are way behind. When you look its way, it waves a branch at you. You notice one of its branches clutch a small chalkboard while another holds a piece of chalk. # Awakened Shrub:2 ends here