pyecs.managers.EntityManager#
- class pyecs.managers.EntityManager[source]#
-
Methods
__init__
()Create a new entity in the entity component system.
destroy_entity
(entity)Remove an entity from the entity component system.
is_alive
(entity)Check if an entity is currently alive in the system.
- create_entity()[source]#
Create a new entity in the entity component system.
This method generates a unique UUID4 identifier for the entity and registers it in the alive_entities set.
Returns a tuple containing ENTITY_CREATED status and the new entity UUID on success. FAILURE is typed for future expansion purposes only; currently cannot be returned.
- destroy_entity(entity)[source]#
Remove an entity from the entity component system.
This method removes the specified entity UUID from the alive_entities set and triggers cleanup of all associated components. The entity becomes invalid after this operation and should not be used in subsequent operations.
Returns ENTITY_DESTROYED status on successful removal, or FAILURE status if the entity does not exist or destruction fails.
- Return type:
Literal
[<StatusCodes.ENTITY_DESTROYED: 101>
,<StatusCodes.FAILURE: -1>
]- Parameters:
entity (Entity)