pyecs.managers#
- class pyecs.managers.EntityManager[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.
- 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)
- class pyecs.managers.SystemManager[source]#
-
- register_system(system)[source]#
Register a new system with the system manager.
This method assigns a unique UUID to the system and adds it to the systems list for execution during world updates.
Returns a tuple containing SYSTEM_REGISTERED status and the system on success, or FAILURE if the system is already registered.
- remove_system(system)[source]#
Remove a system from the system manager by reference.
This convenience method allows removal using the System object directly rather than requiring the UUID. Internally delegates to unregister_system.
Returns SYSTEM_UNREGISTERED on successful removal, or FAILURE if the system is not currently registered.
- unregister_system(id)[source]#
Remove a system from the system manager by UUID.
This method removes the specified system from all tracking structures and prevents it from being executed during world updates.
Returns SYSTEM_UNREGISTERED on successful removal, or FAILURE if the system ID does not exist.
- Return type:
Literal
[<StatusCodes.SYSTEM_UNREGISTERED: 301>
,<StatusCodes.FAILURE: -1>
]- Parameters:
id (pyecs.common.Types.UUID4)
- update_all(world, dt)[source]#
Execute the update method for all registered systems.
This method calls the update method on each registered system in registration order, passing the world instance and delta time.
Systems are responsible for querying entities and performing their specific logic during this update cycle.
Modules