evennia.contrib.base_systems.components.component¶
Components - ChrisLR 2022
This file contains the base class to inherit for creating new components.
-
class
evennia.contrib.base_systems.components.component.
Component
(host=None)[source]¶ Bases:
object
This is the base class for components. Any component must inherit from this class to be considered for usage.
Each Component must supply the name, it is used as a slot name but also part of the attribute key.
-
name
= ''¶
-
classmethod
default_create
(host)[source]¶ - This is called when the host is created
and should return the base initialized state of a component.
- Parameters
host (object) – The host typeclass instance
- Returns
Component – The created instance of the component
-
classmethod
create
(host, **kwargs)[source]¶ This is the method to call when supplying kwargs to initialize a component.
- Parameters
host (object) – The host typeclass instance
**kwargs – Key-Value of default values to replace. To persist the value, the key must correspond to a DBField.
- Returns
Component – The created instance of the component
-
classmethod
load
(host)[source]¶ - Loads a component instance
This is called whenever a component is loaded (ex: Server Restart)
- Parameters
host (object) – The host typeclass instance
- Returns
Component – The loaded instance of the component
-
at_added
(host)[source]¶ This is the method called when a component is registered on a host.
- Parameters
host (object) – The host typeclass instance
-
at_removed
(host)[source]¶ This is the method called when a component is removed from a host.
- Parameters
host (object) – The host typeclass instance
-
property
attributes
¶ Shortcut property returning the host’s AttributeHandler.
- Returns
AttributeHandler – The Host’s AttributeHandler
-
property
nattributes
¶ Shortcut property returning the host’s In-Memory AttributeHandler (Non Persisted).
- Returns
AttributeHandler – The Host’s In-Memory AttributeHandler
-
property
db_field_names
¶
-
property
ndb_field_names
¶
-
property
tag_field_names
¶
-