Conversation
Deploying excaliburjs with
|
| Latest commit: |
70a39b3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a9da4128.excaliburjs.pages.dev |
| Branch Preview URL: | https://pausecomponent.excaliburjs.pages.dev |
|
Oops, I didn't want to "delete" it from the tree, just revert/delete it from the PR 🙃 |
|
|
||
| The Pause System consists of two main components: | ||
|
|
||
| - **`PauseComponent`** - A component that already is attached to [Actors](/docs/actors) |
There was a problem hiding this comment.
nitpick: flip 'already' and 'is'. (A component that is already ...)
|
|
||
| public systemType = SystemType.Update; | ||
| public query: Query<ComponentCtor<TransformComponent> | ComponentCtor<ColliderComponent>>; | ||
| public query: Query<ComponentCtor<TransformComponent> | ComponentCtor<ColliderComponent> | typeof PauseComponent>; |
There was a problem hiding this comment.
When would one reach for ComponentCtor<T> vs straight up typeof ...?
There was a problem hiding this comment.
I actually don't know the answer to this, i was just following the documented pattern. maybe @eonarheim would know?
| const paused = entity.get(PauseComponent); | ||
| if (paused.paused) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Can this go above const colliderComp on line 106 since we wouldn't be using it if paused?
| } | ||
|
|
||
| /** | ||
| * Event thown on a pause event in scene |
There was a problem hiding this comment.
nitpick: thown => thrown
Same one line 782.
Copy 🍝?
| paused = entity.get(PauseComponent); | ||
| if (paused.paused) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
is it worth moving this after line 24 since we'll continue if paused?
|
@sweenist i can address fixes tomorrow... too tired |
|
This PR hasn't had any recent activity lately and is being marked as stale automatically. |
PR Description: Pause System Component Implementation
Overview
Implements a comprehensive pause system for the Excalibur game engine using the ECS (Entity Component System) architecture, allowing selective pausing of entities while maintaining fine-grained control over game state.
Changes Made
Core Components:
PauseComponent - New ECS component tracking pause state and pausability with paused (read-only) and canPause properties
PauseSystem - New ECS system that manages pause state across entities, listening to scene pause/resume events and updating component states accordingly
ActorArgs: added canPause:boolean as optional argument
Scene Integration:
Added pauseScene() and resumeScene() methods to Scene class
Integrated PauseSystem into scene initialization
Scene events emit pause/resume notifications for UI and other systems
all default system updates now monitor pause status
Exports:
Exported PauseComponent from ECS module index
Exported PauseSystem from main engine utilities
Documentation:
Added comprehensive 12-pausing.mdx guide covering:
System overview and architecture
Quick start examples
PauseComponent properties and usage
Scene event handling for pause menus
Testing:
Added full test suite in pause-spec.ts with 12+ test cases covering:
System initialization
Scene event handling
Per-entity pause control
Multi-entity scenarios
Dynamic property changes
Resume/pause toggling
Key Features
Selective entity pausing (only pause entities with canPause: true)
Non-pausable entities continue updating during scene pause
Clean scene-level pause/resume API
Event-driven architecture for UI integration
Full backward compatibility