From 2a34e9d05dbb08c79cc896a9151bbdfd882c1e6d Mon Sep 17 00:00:00 2001 From: ChrisLR Date: Sun, 2 Apr 2023 17:00:27 -0400 Subject: [PATCH] Prevent child typeclasses class components from merging to inherited class components --- evennia/contrib/base_systems/components/holder.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/evennia/contrib/base_systems/components/holder.py b/evennia/contrib/base_systems/components/holder.py index 91d4330f58..7d19d344b0 100644 --- a/evennia/contrib/base_systems/components/holder.py +++ b/evennia/contrib/base_systems/components/holder.py @@ -36,9 +36,11 @@ class ComponentProperty: raise Exception("Cannot set a class property") def __set_name__(self, owner, name): - class_components = getattr(owner, "_class_components", None) + # Retrieve the class_components set on the direct class only + class_components = owner.__dict__.get("_class_components") if not class_components: - class_components = [] + # Create a new list, including inherited class components + class_components = list(getattr(owner, "_class_components", [])) setattr(owner, "_class_components", class_components) class_components.append((self.component_name, self.values))