Puppets change pose automatically

This commit is contained in:
Howard Abrams 2025-07-02 21:51:32 -07:00
parent b0618891c8
commit 39deff444e
2 changed files with 23 additions and 6 deletions

View file

@ -294,7 +294,9 @@ class Object(ObjectParent, ContribRPObject):
if m:
delay(pause, self.location.msg_contents, routput(m.group(2), *args))
else:
delay(pause, self.execute_cmd, routput(line, *args))
cmd = routput(line, *args)
logger.info(f"Executing: {cmd}")
delay(pause, self.execute_cmd, cmd)
def at_post_move(self, source_location, move_type="move", **kwargs):
"""

View file

@ -35,14 +35,17 @@ class Puppet(Character):
"""
self.msg(f"\nYou are puppeting |c{self.key}|n.")
self.execute_cmd("pose reset")
self.msg((self.at_look(self.location), {"type": "look"}), options=None)
def at_pre_unpuppet(self, **kwargs):
"""
Reset our pose.
Set our 'sleeping' pose.
"""
super().at_pre_unpuppet()
self.execute_cmd("pose reset")
sleep_pose = self.attributes.get("pose_sleep")
if sleep_pose:
self.execute_cmd(f"pose {sleep_pose}")
def at_post_unpuppet(self, account=None, session=None, **kwargs):
"""
@ -82,11 +85,23 @@ class Puppet(Character):
# TRIGGERS
def get_character_label(self, character):
return character.get_display_name(self).split(' ')[-1]
cleaned = sub(r"|[A-z/]", "",
character.get_display_name(self))
return cleaned.split(' ')[-1]
def trigger_sequence(self, seq, character, *other_stuff):
self.delay_sequence(seq, 1, character.key, character.get_display_name(self),
self.get_character_label(character), *other_stuff)
"""
The actions associated with the trigger
{0} - character's real name
{1} - character's sdesc (from puppet's pov)
{2} - character's label, last word in sdesc
{3} - character object
"""
self.delay_sequence(seq, 1, character.key,
character.get_display_name(self),
self.get_character_label(character),
character, *other_stuff)
def get_attribute_trigger(self, label, character):
"""