From 588ffcdab84c491cfb130f2b9ba4e7d100796fe0 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Mon, 7 Apr 2025 23:14:13 -0700 Subject: [PATCH] Fix feeding pets --- typeclasses/objects.py | 8 ++++---- typeclasses/pets.py | 34 ---------------------------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/typeclasses/objects.py b/typeclasses/objects.py index e82271c..7a33836 100755 --- a/typeclasses/objects.py +++ b/typeclasses/objects.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from evennia.utils import logger +from evennia.utils import delay, logger """ Object @@ -246,8 +246,8 @@ class Object(ObjectParent, DefaultObject): def at_post_move(self, source_location, move_type="move", **kwargs): """ - Delete ourselves if we are living in the fireplace. + Delete ourselves if we are living inside a pet. """ - logger.log_info("Can we delete?") + super().at_post_move(source_location, move_type) if self.location.is_typeclass("typeclasses.pets.Pet"): - self.delete() + delay(5, self.delete) diff --git a/typeclasses/pets.py b/typeclasses/pets.py index b497da2..fbd6445 100755 --- a/typeclasses/pets.py +++ b/typeclasses/pets.py @@ -194,7 +194,6 @@ class Fire(Pet): giver.msg(f"You throw {moved_obj.name} in the fireplace, destroying it.") return True - # def at_post_move(self, source_location, move_type, **kwargs): # ---------------------------------------------------------------------- # Friendly @@ -402,36 +401,3 @@ class Friendly(Pet): ) self.location.msg_contents(sub("<[Yy]ou>", focus.name.title(), msg), exclude=focus) - - -class Imp(Friendly): - def action(self): - # Do something based on the highest friendly level is the same area! - # Need a ticker .. - # (state, chars) = self.highest_friendly_level() - pass - - def update_state(self, *args, **kwargs): - pass - - -class BHB(Friendly): - "The Big Hairy Beast object." - def action(self): - # Do something based on the highest friendly level is the same area! - # Need a ticker .. - # (state, chars) = self.highest_friendly_level() - pass - # - < 10 : Attempts to hide - # - < 20 : Steers clear but doesn’t hide - # - < 50 : Wags it tail/butt - # - > 50 : Follows you - # level = self.friendly_level(looker) - # if level == 0: - # return f"You see a massive shadow lurking " - # if level < 10: - # return f"{self.db.desc} {self.hunger_appearance()}" - - def given(self, giver, thing): - # if obj.is_typeclass("typeclasses.things.Wood"): - return True