moss-n-puddles/typeclasses/puppets.py
2025-05-03 21:20:18 -07:00

48 lines
1.7 KiB
Python
Executable file

#!/usr/bin/env python
from typeclasses.characters import Character
from utils.word_list import routput
class Puppet(Character):
"""
Special character that if not puppetable, stays put.
Perhaps responding or logging information to the GM.
"""
def at_post_puppet(self, **kwargs):
"""
Called just after puppeting has been completed and all
Account<->Object links have been established.
Args:
**kwargs (dict): Arbitrary, optional arguments for users
overriding the call (unused by default).
Notes:
You can use `self.account` and `self.sessions.get()` to get
account and sessions at this point; the last entry in the
list from `self.sessions.get()` is the latest Session
puppeting this Object.
"""
self.msg("\nYou are puppeting |c{name}|n.\n".format(name=self.key))
self.msg((self.at_look(self.location), {"type": "look"}), options=None)
def at_post_unpuppet(self, account=None, session=None, **kwargs):
"""
Make the character object remain in the room.
Args:
account (DefaultAccount): The account object that just disconnected
from this object.
session (Session): Session controlling the connection that
just disconnected.
Keyword Args:
reason (str): If given, adds a reason for the unpuppet. This
is set when the user is auto-unpuppeted due to being link-dead.
**kwargs: Arbitrary, optional arguments for users
overriding the call (unused by default).
"""
self.msg("\nNo longer puppeting |c{name}|n.\n".format(name=self.key))