From a38b179e511a996a48c90095495b10ca8b07a356 Mon Sep 17 00:00:00 2001 From: JohniFi <25084862+JohniFi@users.noreply.github.com> Date: Thu, 27 Mar 2025 11:11:50 +0100 Subject: [PATCH] Update init_evennia_properties() to also init properties of parent classes --- evennia/typeclasses/models.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/evennia/typeclasses/models.py b/evennia/typeclasses/models.py index 476e11b045..baf6a1c035 100644 --- a/evennia/typeclasses/models.py +++ b/evennia/typeclasses/models.py @@ -347,12 +347,21 @@ class TypedObject(SharedMemoryModel): Called by creation methods; makes sure to initialize Attribute/TagProperties by fetching them once. """ - for propkey, prop in self.__class__.__dict__.items(): - if isinstance(prop, (AttributeProperty, TagProperty, TagCategoryProperty)): - try: - getattr(self, propkey) - except Exception: - log_trace() + evennia_properties = set() + for base in type(self).__mro__: + evennia_properties.update( + { + propkey + for propkey, prop in vars(base).items() + if isinstance(prop, (AttributeProperty, TagProperty, TagCategoryProperty)) + } + ) + + for propkey in evennia_properties: + try: + getattr(self, propkey) + except Exception: + log_trace() # initialize all handlers in a lazy fashion @lazy_property