Allow the shrub to speak!

This commit is contained in:
Howard Abrams 2025-05-26 14:43:59 -07:00
parent 2e69558b3f
commit 1cb69a9ab4
2 changed files with 37 additions and 4 deletions

View file

@ -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)

View file

@ -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