-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
A-StatesApp-level states machinesApp-level states machinesC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
What problem does this solve or what need does it fill?
There is State and NextState, but no PreviousState. This means to handle transitions you have to pre-specify all state transition variants at the type level with OnTransition{ exited: AppState::Previous, entered: AppState::Other }.
It would be useful if system in OnEnter could access the state that was recently exited or if OnTransition could support the root AppState instead of a specific variant.
What solution would you like?
Options:
- A readable
PreviousStateresource, similar toStateandNextState. - An
OnTransitionvariant that can match any/all variants of a state.
What alternative(s) have you considered?
- Specifying all transitions at the type level in separate.
- Making the Resource that holds previous state in userland
Additional context
This feature was asked for by Calin, I am filing it for them after asking about their usecase since they don't have gh access at the moment.
my use-case here specifically is making a Gamestate variant, Refresh, which takes the PreviousState and uses it to determine what should happen (in a system that handles state refreshes).
- Calin
NicoZweifel, z-jxy and KattyTheEnby
Metadata
Metadata
Assignees
Labels
A-StatesApp-level states machinesApp-level states machinesC-FeatureA new feature, making something new possibleA new feature, making something new possibleD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!