From 5a1ef48ce5aaec327998cacce1ba61c35cc051d4 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Wed, 4 Jun 2025 17:43:13 -0700 Subject: [PATCH] Fix bugs in taking things away from their tethers --- typeclasses/characters.py | 17 +++++++---------- typeclasses/sittables.py | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/typeclasses/characters.py b/typeclasses/characters.py index 94906cb..7d09de1 100644 --- a/typeclasses/characters.py +++ b/typeclasses/characters.py @@ -244,16 +244,19 @@ class Character(Object, GenderCharacter, ContribRPCharacter): if to: m = match(r".*:id\((.*)\)", to) if m: - id_num = m.group(1) - dest = self.search(f"{id_num}") + location = m.group(1) + dest = self.search(location) msg = thing.db.tethered_msg if dest and msg: thing.location = dest self.msg(msg) else: - print(f"Found tethered, {thing} to #{id_num}, but dest is {dest} and msg is '{msg}'. Set both.") + logger.warn(f"Found tethered, {thing} to #{location}, but dest is {dest} and msg is '{msg}'. Set both.") else: - print(f"Found tethered, {thing} to #{to}, but that needs to be 'tethered:id(num) where num is the ID# of an object/place.") + logger.warn(f"Found tethered, {thing} to #{to}, but that needs to be 'tethered:id(num) where num is the ID# of an object/place.") + + for puppet in self.puppets_here(): + puppet.other_leave(self) return super().at_pre_move(destination) @@ -365,12 +368,6 @@ class Character(Object, GenderCharacter, ContribRPCharacter): for puppet in self.puppets_here(): puppet.other_arrive(self) - def at_pre_move(self, destination, move_type="move", **kwargs): - super().at_pre_move(destination, move_type) - for puppet in self.puppets_here(): - puppet.other_leave(self) - return True - def deeper_search(self, item_str): targets = self.search(item_str, quiet=True) if len(targets) > 0: diff --git a/typeclasses/sittables.py b/typeclasses/sittables.py index 326b96e..6ae8650 100755 --- a/typeclasses/sittables.py +++ b/typeclasses/sittables.py @@ -40,7 +40,7 @@ class Sittable(Object): # Clean up an issue that sometimes someone logs off or leaves # a room without standing first. if self.db.sitter: - if not self.location.has(self.db.sitter): + if self.db.sitter not in self.location.contents: self.db.sitter = None if self.db.sitter and not self.multiple: