Make default state change trigger self state transitions#21792
Make default state change trigger self state transitions#21792alice-i-cecile merged 12 commits intobevyengine:mainfrom
Conversation
|
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
|
|
We shouldn't change the default on only one of the method, they should all behave the same 👍 |
|
Nit: nowhere in std and bevy "not equal" is written as |
| // Not configurable for the moment. This controls whether inserting a state with the same value as a pre-existing state should run state transitions. | ||
| // Leaving it at `true` makes state insertion idempotent. Neat! | ||
| allow_same_state_transitions: true, |
There was a problem hiding this comment.
Confused here, if allow_same_state_transitions is true, then same state transitions are allowed, and the state transition systems should be run? Wouldn't state insertion be idempotent then when allow_same_state_transitions is false?
There was a problem hiding this comment.
No, since when deactivated, inserting the state without it pre-existing will trigger transitions, and then inserting it a second time won't.
Component change detection has a |
|
I believe the blocking feedback was based on a misconception. This PR changes the default on all methods, not just on one. |
| type SourceStates: StateSet; | ||
|
|
||
| /// Whether state transition schedules should be run when the state changes to the same value. Default is `true`. | ||
| const ALLOW_SAME_STATE_TRANSITIONS: bool = true; |
There was a problem hiding this comment.
it is unclear to me why this const exists.
There was a problem hiding this comment.
Did discovery. This exists because of this discord conversation: https://discord.com/channels/691052431525675048/749335865876021248/1437152386345996430
Which is intended to be a computed_states on/off flag for either always or never triggering. In this case the default is "always trigger".
It is used in state/state_set, which is updated in this PR.
Objective
set_forced)Solution
set->set_if_neqset_forced->setTesting