Skip to content

Allow add_state_scoped_event to take computed state #18623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aleqdev opened this issue Mar 30, 2025 · 1 comment · Fixed by #19401
Closed

Allow add_state_scoped_event to take computed state #18623

aleqdev opened this issue Mar 30, 2025 · 1 comment · Fixed by #19401
Labels
A-States App-level states machines C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon

Comments

@aleqdev
Copy link

aleqdev commented Mar 30, 2025

What problem does this solve or what need does it fill?

Currently add_state_scoped_event takes impl FreelyMutableState, which prevents computed state to be used.

What solution would you like?

Instead, make it take impl States

What alternative(s) have you considered?

As for now, issue can be avoided by manually deriving FreelyMutableState for a type, but as far as i can see there is no reason for add_state_scoped_event api to take it instead of just States

Additional context

Just changing FreelyMutableState to States in bevy_state:state_scoped_events.rs compiles

@aleqdev aleqdev added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Mar 30, 2025
@alice-i-cecile alice-i-cecile added S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon D-Straightforward Simple bug fixes and API improvements, docs, test and examples A-States App-level states machines and removed S-Needs-Triage This issue needs to be labelled labels Apr 1, 2025
@alice-i-cecile
Copy link
Member

I'd welcome a PR for this; I think our bound is too restrictive.

github-merge-queue bot pushed a commit that referenced this issue May 29, 2025
Fixes #18623, allowing `add_state_scoped_event` to work with computed
states.

As a side note, should state scoped events be updated to match the
recently changed [state scoped
entities](https://github.com/bevyengine/bevy/blob/main/release-content/migration-guides/rename_StateScoped.md)?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-States App-level states machines C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants