diff --git a/commands/everyone.py b/commands/everyone.py index 08f6b0f..8bfeae6 100755 --- a/commands/everyone.py +++ b/commands/everyone.py @@ -407,7 +407,17 @@ class CmdTake(CmdGet, NumberedTargetCommand): else: super().func() # Call the 'get' function instead. else: - self.caller.do_take(self.lhs, self.rhs) + location = self.caller.search(self.rhs, quiet=True) + if len(location) == 0: + self.caller.msg(f"Can't take '{self.lhs}' from '{self.rhs}'.") + return + + location = location[0] + if location.is_typeclass("typeclasses.rooms.Room"): + self.args = self.lhs + super().func() # Call the 'get' function instead. + return + self.caller.do_take(self.lhs, location) class CmdDrink(Command): diff --git a/typeclasses/characters.py b/typeclasses/characters.py index 855cbe1..eddce88 100644 --- a/typeclasses/characters.py +++ b/typeclasses/characters.py @@ -229,19 +229,19 @@ class Character(Object, GenderCharacter, ContribRPCharacter): def get_display_things(self, looker, *args, **kwargs): return super().get_display_things(looker, pose=False) - def do_take(self, to_take, from_whom): + def do_take(self, to_take, victim): """ A character has a _steal_command. What are the limitations? """ - victim = self.search(from_whom) if victim: - thing = victim.has(to_take) + thing = None + if hasattr(victim, 'has') and callable(getattr(victim, 'has')): + thing = victim.has(to_take) if thing and thing.db.can_take: self.msg(f"You take {thing.key} from {victim.key}.") thing.move_to(self, quiet=True, use_destination=True) return - - self.msg(f"{victim.key} doesn't have a {to_take} you can take.") + self.msg(f"{victim.key} doesn't have a {to_take} you can take.") def pronoun_subjective(self, uppercase=False): gender = self.attributes.get('gender')