mini_arcade_core.scenes.systems.builtins.projectiles ==================================================== .. py:module:: mini_arcade_core.scenes.systems.builtins.projectiles .. autoapi-nested-parse:: Reusable projectile lifecycle systems. Classes ------- .. autoapisummary:: mini_arcade_core.scenes.systems.builtins.projectiles.ProjectileBoundaryBinding mini_arcade_core.scenes.systems.builtins.projectiles.ProjectileBoundarySystem mini_arcade_core.scenes.systems.builtins.projectiles.ProjectileCleanupBinding mini_arcade_core.scenes.systems.builtins.projectiles.ProjectileCleanupSystem mini_arcade_core.scenes.systems.builtins.projectiles.ProjectileLifecycleBinding mini_arcade_core.scenes.systems.builtins.projectiles.ProjectileLifecycleBundle Module Contents --------------- .. py:class:: ProjectileBoundaryBinding Bases: :py:obj:`Generic`\ [\ :py:obj:`TCtx`\ ] Culling rule for projectile-like entities. .. py:attribute:: entities_getter :type: Callable[[TCtx], Iterable[mini_arcade_core.engine.entities.BaseEntity]] .. py:attribute:: predicate :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], bool] .. py:attribute:: margin :type: float :value: 0.0 .. py:attribute:: margin_getter :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], float] .. py:attribute:: on_cull :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], None] .. py:class:: ProjectileBoundarySystem Bases: :py:obj:`Generic`\ [\ :py:obj:`TCtx`\ ] Cull projectile-like entities against the current viewport. .. py:attribute:: name :type: str :value: 'common_projectile_boundary' .. py:attribute:: phase :type: int .. py:attribute:: order :type: int :value: 36 .. py:attribute:: enabled_when :type: Callable[[TCtx], bool] .. py:attribute:: bindings :type: tuple[ProjectileBoundaryBinding[TCtx], Ellipsis] :value: () .. py:method:: __post_init__() -> None .. py:method:: step(ctx: TCtx) -> None For each binding, cull entities that don't satisfy the predicate and are outside the viewport plus margin. :param ctx: The context object passed to the system, typically containing references to the world, scene, and other relevant state. :type ctx: TCtx .. py:class:: ProjectileCleanupBinding Bases: :py:obj:`Generic`\ [\ :py:obj:`TCtx`\ ] Cleanup rule for projectile-like entities. .. py:attribute:: entities_getter :type: Callable[[TCtx], Iterable[mini_arcade_core.engine.entities.BaseEntity]] .. py:attribute:: keep_entity :type: Callable[[mini_arcade_core.engine.entities.BaseEntity], bool] .. py:attribute:: tracked_ids_attr :type: str | None :value: None .. py:attribute:: tracked_domain_name :type: str | None :value: None .. py:class:: ProjectileCleanupSystem Bases: :py:obj:`Generic`\ [\ :py:obj:`TCtx`\ ] Remove dead projectile-like entities and optionally compact tracked ids. .. py:attribute:: name :type: str :value: 'common_projectile_cleanup' .. py:attribute:: phase :type: int .. py:attribute:: order :type: int :value: 46 .. py:attribute:: enabled_when :type: Callable[[TCtx], bool] .. py:attribute:: bindings :type: tuple[ProjectileCleanupBinding[TCtx], Ellipsis] :value: () .. py:method:: step(ctx: TCtx) -> None For each binding, remove entities that don't satisfy keep_entity, and if tracked_ids_attr and tracked_domain_name are provided, compact the tracked ids for the remaining entities. :param ctx: The context object passed to the system, typically containing references to the world, scene, and other relevant state. :type ctx: TCtx .. py:class:: ProjectileLifecycleBinding Bases: :py:obj:`Generic`\ [\ :py:obj:`TCtx`\ ] Full projectile lifecycle configuration for motion, culling, and cleanup. .. py:attribute:: entities_getter :type: Callable[[TCtx], Iterable[mini_arcade_core.engine.entities.BaseEntity]] .. py:attribute:: predicate :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], bool] .. py:attribute:: dt_getter :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], float] .. py:attribute:: drag :type: float | None :value: None .. py:attribute:: drag_getter :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], float | None] | None :value: None .. py:attribute:: spin_attr :type: str | None :value: None .. py:attribute:: ttl_step :type: bool :value: False .. py:attribute:: margin :type: float :value: 0.0 .. py:attribute:: margin_getter :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], float] .. py:attribute:: on_cull :type: Callable[[TCtx, mini_arcade_core.engine.entities.BaseEntity], None] .. py:attribute:: keep_entity :type: Callable[[mini_arcade_core.engine.entities.BaseEntity], bool] .. py:attribute:: tracked_ids_attr :type: str | None :value: None .. py:attribute:: tracked_domain_name :type: str | None :value: None .. py:class:: ProjectileLifecycleBundle Bases: :py:obj:`mini_arcade_core.scenes.systems.SystemBundle`\ [\ :py:obj:`TCtx`\ ] Compose motion, boundary, and cleanup for projectile-like entities. .. py:attribute:: bindings :type: tuple[ProjectileLifecycleBinding[TCtx], Ellipsis] :value: () .. py:attribute:: enabled_when :type: Callable[[TCtx], bool] .. py:attribute:: motion_name :type: str :value: 'common_projectile_motion' .. py:attribute:: motion_phase :type: int .. py:attribute:: motion_order :type: int :value: 30 .. py:attribute:: boundary_name :type: str :value: 'common_projectile_boundary' .. py:attribute:: boundary_phase :type: int .. py:attribute:: boundary_order :type: int :value: 36 .. py:attribute:: cleanup_name :type: str :value: 'common_projectile_cleanup' .. py:attribute:: cleanup_phase :type: int .. py:attribute:: cleanup_order :type: int :value: 46 .. py:attribute:: include_motion :type: bool :value: True .. py:attribute:: include_boundary :type: bool :value: True .. py:attribute:: include_cleanup :type: bool :value: True .. py:method:: __post_init__() -> None .. py:method:: iter_systems() -> Iterable[object] Return the concrete systems that should be added to the pipeline.