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] - Add timer-based common run conditions (on_timer and on_fixed_timer) #7866

Closed
wants to merge 3 commits into from

Conversation

jabuwu
Copy link
Contributor

@jabuwu jabuwu commented Mar 2, 2023

Objective

Fixes #7864

Solution

Add the run conditions described in the issue. Also needed to add bevy as a dev dependency to bevy_time so the doctests can run.


Changelog

  • Add on_timer and on_fixed_timer run conditions

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2023

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@mockersf
Copy link
Member

mockersf commented Mar 2, 2023

I would prefer to not add the full bevy dependency just for doc tests...
bevy_app is already in the dependencies, that should be enough to write an example that compiles.

For an example, see

/// ```no_run
/// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, PluginGroup};
/// # use bevy_log::LogPlugin;
/// # use bevy_utils::tracing::Level;
/// fn main() {
/// App::new()
/// .add_plugins(DefaultPlugins.set(LogPlugin {
/// level: Level::DEBUG,
/// filter: "wgpu=error,bevy_render=info,bevy_ecs=trace".to_string(),
/// }))
/// .run();
/// }
/// ```

Also you can hide lines not relevant by adding a # first

@mockersf mockersf added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events A-Time Involves time keeping and reporting labels Mar 2, 2023
@jabuwu
Copy link
Contributor Author

jabuwu commented Mar 2, 2023

I would prefer to not add the full bevy dependency just for doc tests...

Good call! I made the change. The only disadvantage is that the sample no longer includes the use statement, and on_timer/on_fixed_timer are not in the prelude (following bevy_input's lead).

Comment on lines +38 to +39
timer.tick(time.delta());
timer.just_finished()
Copy link
Member

Choose a reason for hiding this comment

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

I think you can do timer.tick(time.delta()).just_finished()

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

bors r+

bors bot pushed a commit that referenced this pull request Mar 2, 2023
…`) (#7866)

# Objective

Fixes #7864

## Solution

Add the run conditions described in the issue. Also needed to add `bevy` as a dev dependency to `bevy_time` so the doctests can run.

---

## Changelog

- Add `on_timer` and `on_fixed_timer` run conditions
@bors bors bot changed the title Add timer-based common run conditions (on_timer and on_fixed_timer) [Merged by Bors] - Add timer-based common run conditions (on_timer and on_fixed_timer) Mar 2, 2023
@bors bors bot closed this Mar 2, 2023
Shfty pushed a commit to shfty-rust/bevy that referenced this pull request Mar 19, 2023
…`) (bevyengine#7866)

# Objective

Fixes bevyengine#7864

## Solution

Add the run conditions described in the issue. Also needed to add `bevy` as a dev dependency to `bevy_time` so the doctests can run.

---

## Changelog

- Add `on_timer` and `on_fixed_timer` run conditions
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 A-Time Involves time keeping and reporting C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add timer-based common run conditions
3 participants