pyecs.managers.EntityManager#

class pyecs.managers.EntityManager[source]#
__init__()[source]#

Methods

__init__()

create_entity()

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.

__init__()[source]#
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.

Return type:

Union[tuple[Literal[<StatusCodes.ENTITY_CREATED: 100>], TypeAliasType], Literal[<StatusCodes.FAILURE: -1>]]

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)

is_alive(entity)[source]#

Check if an entity is currently alive in the system.

Returns True if the entity exists in the alive_entities set, False otherwise.

Return type:

bool

Parameters:

entity (Entity)