Fix bugs in taking things away from their tethers

This commit is contained in:
Howard Abrams 2025-06-04 17:43:13 -07:00
parent afb092bfb0
commit 5a1ef48ce5
2 changed files with 8 additions and 11 deletions

View file

@ -244,16 +244,19 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
if to: if to:
m = match(r".*:id\((.*)\)", to) m = match(r".*:id\((.*)\)", to)
if m: if m:
id_num = m.group(1) location = m.group(1)
dest = self.search(f"{id_num}") dest = self.search(location)
msg = thing.db.tethered_msg msg = thing.db.tethered_msg
if dest and msg: if dest and msg:
thing.location = dest thing.location = dest
self.msg(msg) self.msg(msg)
else: 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: 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) return super().at_pre_move(destination)
@ -365,12 +368,6 @@ class Character(Object, GenderCharacter, ContribRPCharacter):
for puppet in self.puppets_here(): for puppet in self.puppets_here():
puppet.other_arrive(self) 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): def deeper_search(self, item_str):
targets = self.search(item_str, quiet=True) targets = self.search(item_str, quiet=True)
if len(targets) > 0: if len(targets) > 0:

View file

@ -40,7 +40,7 @@ class Sittable(Object):
# Clean up an issue that sometimes someone logs off or leaves # Clean up an issue that sometimes someone logs off or leaves
# a room without standing first. # a room without standing first.
if self.db.sitter: 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 self.db.sitter = None
if self.db.sitter and not self.multiple: if self.db.sitter and not self.multiple: