""" Characters Characters are (by default) Objects setup to be puppeted by Accounts. They are what you "see" in game. The Character class in this module is setup to be the "default" character type created by the default creation commands. """ from evennia.objects.objects import DefaultCharacter from utils.word_list import Token, routput from .objects import ObjectParent class Character(ObjectParent, DefaultCharacter): """ The Character just re-implements some of the Object's methods and hooks to represent a Character entity in-game. See mygame/typeclasses/objects.py for a list of properties and methods available on all Object child classes like this. """ def do_take(self, args): """ A character has a _steal_command. What are the limitations? """ args = Token(args) if args.empty(): self.msg("What do you want to take?") elif len(args.words) == 1: self.msg(f"You want to take {args.words[0]}, but from whom?") else: to_take = args.words[0] from_whom = args.words[-1] victim = self.search(from_whom) if victim: thing = victim.has(to_take) if thing: self.msg(f"You take {thing.key} from {victim.key}.") self.location.msg_contents( f"{self.key} takes {thing.key} from {victim.key}!", exclude=self) thing.move_to(self, quiet=True, use_destination=True) return self.msg(f"{victim.key} doesn't have a {to_take}.") # else: # self.msg(f"You don't see a {from_whom}.") def at_pre_move(self, destination, **kwargs): """ Called by self.move_to when trying to move somewhere. If this returns False, the move is immediately cancelled. """ if self.db.is_sitting: self.msg("You need to stand up first.") return False return True