From 0729de1b91bd251bb401b1f584a5a24239dfed56 Mon Sep 17 00:00:00 2001 From: ChrisLR Date: Sat, 24 Feb 2024 11:12:49 -0500 Subject: [PATCH] Use get_component_slot --- evennia/contrib/base_systems/components/dbfield.py | 6 +++--- evennia/contrib/base_systems/components/holder.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/evennia/contrib/base_systems/components/dbfield.py b/evennia/contrib/base_systems/components/dbfield.py index 709548acf3..eae4285c17 100644 --- a/evennia/contrib/base_systems/components/dbfield.py +++ b/evennia/contrib/base_systems/components/dbfield.py @@ -29,7 +29,7 @@ class DBField(AttributeProperty): owner (Component): The component classF on which this is set name (str): The name that was used to set the DBField. """ - self._key = f"{owner.slot or owner.name}::{name}" + self._key = f"{owner.get_component_slot()}::{name}" owner.add_field(name, self) def at_added(self, component): @@ -69,7 +69,7 @@ class NDBField(NAttributeProperty): owner (Component): The component class on which this is set name (str): The name that was used to set the DBField. """ - self._key = f"{owner.slot or owner.name}::{name}" + self._key = f"{owner.get_component_slot()}::{name}" owner.add_field(name, self) def at_added(self, component): @@ -113,7 +113,7 @@ class TagField: Called when TagField is first assigned to the class. It is called with the component class and the name of the field. """ - self._category_key = f"{owner.slot or owner.name}::{name}" + self._category_key = f"{owner.get_component_slot()}::{name}" owner.add_field(name, self) def __get__(self, instance, owner): diff --git a/evennia/contrib/base_systems/components/holder.py b/evennia/contrib/base_systems/components/holder.py index 55d00f028c..a09844f457 100644 --- a/evennia/contrib/base_systems/components/holder.py +++ b/evennia/contrib/base_systems/components/holder.py @@ -34,7 +34,7 @@ class ComponentProperty: if not self.component_class: component_class = get_component_class(self.name) self.component_class = component_class - self.slot_name = component_class.slot or component_class.name + self.slot_name = component_class.get_component_slot() component = instance.components.get(self.slot_name) return component @@ -107,7 +107,7 @@ class ComponentHandler: """ name = component.name - slot_name = component.slot or name + slot_name = component.get_component_slot() if not self.has(slot_name): message = ( f"Cannot remove {name} from {self.host.name} as it is not registered." @@ -181,7 +181,7 @@ class ComponentHandler: """ Sets the loaded component in this instance. """ - slot_name = component.slot or component.name + slot_name = component.get_component_slot() self._loaded_components[slot_name] = component self.host.signals.add_object_listeners_and_responders(component)