Skip to content
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

[Merged by Bors] - Implement From<bool> for ShouldRun. #5306

Closed

Conversation

tim-blackbird
Copy link
Contributor

Make writing simple yes/no run criteria easier.

@tim-blackbird tim-blackbird changed the title impl From<bool> for ShouldRun. Implement From<bool> for ShouldRun. Jul 13, 2022
Copy link
Contributor

@CGMossa CGMossa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mockersf mockersf added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Jul 14, 2022
Copy link
Contributor

@IceSentry IceSentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is good, but now it makes me wonder why we use ShouldRun instead of bool in the first place. If the intention was to eventually extend it, this will break the impl if that ever happens.

@tim-blackbird
Copy link
Contributor Author

tim-blackbird commented Jul 14, 2022

@IceSentry ShouldRun already has more variants than just Yes and No, if that was what you meant.

Run-criteria are kinda cursed. They have the ability to rerun themselves and the systems they control.
It's how fixed timestep is currently implemented: https://github.com/bevyengine/bevy/blob/main/crates/bevy_time/src/fixed_timestep.rs#L151-L174.

I doubt we will extend ShouldRun in a way that converting from a bool stops making sense,,
and I hope we can yeet the current impl and replace it with the relevant parts of stageless before 0.9.

@IceSentry
Copy link
Contributor

Oh, you're right, sorry, it was a bit too early in the morning for me to do a review 😅

@alice-i-cecile
Copy link
Member

bors r+

@alice-i-cecile
Copy link
Member

This is a good stopgap. I intend to remove the ShouldRun type completely in favor of a bool by 0.9, but that's easy to do regardless.

bors bot pushed a commit that referenced this pull request Jul 14, 2022
Make writing simple yes/no run criteria easier.


Co-authored-by: devil-ira <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 14, 2022

Timed out.

@alice-i-cecile
Copy link
Member

bors retry

bors bot pushed a commit that referenced this pull request Jul 14, 2022
Make writing simple yes/no run criteria easier.


Co-authored-by: devil-ira <[email protected]>
@bors bors bot changed the title Implement From<bool> for ShouldRun. [Merged by Bors] - Implement From<bool> for ShouldRun. Jul 14, 2022
@bors bors bot closed this Jul 14, 2022
@tim-blackbird tim-blackbird deleted the run-criteria-ergo branch July 14, 2022 18:45
inodentry pushed a commit to IyesGames/bevy that referenced this pull request Aug 8, 2022
Make writing simple yes/no run criteria easier.


Co-authored-by: devil-ira <[email protected]>
james7132 pushed a commit to james7132/bevy that referenced this pull request Oct 28, 2022
Make writing simple yes/no run criteria easier.


Co-authored-by: devil-ira <[email protected]>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
Make writing simple yes/no run criteria easier.


Co-authored-by: devil-ira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants