entities.dictionary module

Provides helper class to store entity instances.

class entities.dictionary.EntityDictionary(factory=<class 'entities._base.Entity'>, *args, **kwargs)[source]

Bases: core.AutoUnload, dict

Helper class used to store entity instances.

__init__(factory=<class 'entities._base.Entity'>, *args, **kwargs)[source]

Initializes the dictionary.

Parameters:
  • factory (callable) –

    Factory class or function used to create missing instances. Set to None to disable this feature.

    Factory signature: index, *args, **kwargs

  • args (tuple) – Arguments passed to the factory class or function.
  • kwargs (dict) – Keyword arguments passed to the factory class or function.
from_inthandle(inthandle)[source]

Returns an entity instance from an inthandle.

Parameters:inthandle (int) – The inthandle.
Return type:Entity
on_automatically_removed(index)[source]

Called when an index is automatically removed.

Parameters:index (int) – The index of the entity instance being removed.