-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Make default state change trigger self state transitions #21792
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
Changes from all commits
e0d82fd
76546d6
155d84a
f8a1b21
bf724b8
bc680df
2434d68
a55397c
bf46ffd
1dbca5e
48bf06f
b66c967
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,9 @@ pub trait ComputedStates: 'static + Send + Sync + Clone + PartialEq + Eq + Hash | |
| /// For example, `(MapState, EnemyState)` is valid, as is `(MapState, Option<EnemyState>)` | ||
| 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; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is unclear to me why this const exists.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
|
|
||
| /// Computes the next value of [`State<Self>`](crate::state::State). | ||
| /// This function gets called whenever one of the [`SourceStates`](Self::SourceStates) changes. | ||
| /// | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confused here, if
allow_same_state_transitionsis true, then same state transitions are allowed, and the state transition systems should be run? Wouldn't state insertion be idempotent then whenallow_same_state_transitionsis false?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, since when deactivated, inserting the state without it pre-existing will trigger transitions, and then inserting it a second time won't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, too sleepy..