From c3042a73b47c744678445b0eb40e596e7c45ef2f Mon Sep 17 00:00:00 2001 From: Rabbival <87331993+Rabbival@users.noreply.github.com> Date: Sat, 21 Feb 2026 16:49:22 +0200 Subject: [PATCH 1/4] [Breaking!] merge TimeRunnerSystemsPlugin into TimeRunnerPlugin make TimeRunnerPlugin generic by taking TimeCtx as generic argument. This way, users only have to register one plugin. --- src/lib.rs | 87 +++++++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b7e93e5..c88f3e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,90 +53,60 @@ use std::marker::PhantomData; pub use time_runner::*; pub use time_span::*; -/// Add [`time_runner_system::`] on schedule #[cfg(feature = "bevy_app")] -#[derive(Debug)] -pub struct TimeRunnerSystemsPlugin +/// Registers all types and adds TimeRunnerRegistrationPlugin with default config +pub struct TimeRunnerPlugin where TimeCtx: Default + Send + Sync + 'static, { - /// All systems will be put to this schedule + /// The schedule on which the time runners would run pub schedule: InternedScheduleLabel, /// The time step ticked by (for example, () for regular time or Fixed for fixed time steps) - _time_step: PhantomData, + marker: PhantomData, + /// Enables [`TimeRunnerDebugPlugin`] with default configuration. + /// You may manually insert [`TimeRunnerDebugPlugin`] for custom configuration. + #[cfg(feature = "debug")] + pub enable_debug: bool, } #[cfg(feature = "bevy_app")] -impl TimeRunnerSystemsPlugin +impl TimeRunnerPlugin where TimeCtx: Default + Send + Sync + 'static, { /// Initializes the plugin to run on the specified schedule - pub fn from_schedule_intern(schedule: InternedScheduleLabel) -> Self { + pub fn in_schedule(schedule: InternedScheduleLabel) -> Self { Self { schedule, - _time_step: Default::default(), + ..Default::default() } } } #[cfg(feature = "bevy_app")] -/// Registers all types and adds TimeRunnerRegistrationPlugin with default config -pub struct TimeRunnerPlugin { - /// The schedule where the default time runners will be registered (TimerRunner<()>) - pub schedule: InternedScheduleLabel, - /// Enables [`TimeRunnerDebugPlugin`] with default configuration. - /// You may manually insert [`TimeRunnerDebugPlugin`] for custom configuration. - #[cfg(feature = "debug")] - pub enable_debug: bool, -} - -#[cfg(feature = "bevy_app")] -impl Default for TimeRunnerPlugin { +impl Default for TimeRunnerPlugin +where + TimeCtx: Default + Send + Sync + 'static, +{ fn default() -> Self { TimeRunnerPlugin { schedule: PostUpdate.intern(), #[cfg(feature = "debug")] enable_debug: true, + marker: PhantomData::default(), } } } #[cfg(feature = "bevy_app")] -impl Plugin for TimeRunnerPlugin { - fn build(&self, app: &mut App) { - if !app.is_plugin_added::>() { - app.add_plugins(TimeRunnerSystemsPlugin::<()>::from_schedule_intern( - self.schedule, - )); - } - app.add_message::(); - - #[cfg(feature = "bevy_reflect")] - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::(); - - #[cfg(feature = "debug")] - if self.enable_debug && !app.is_plugin_added::() { - app.add_plugins(TimeRunnerDebugPlugin::default()); - } - } -} - -#[cfg(feature = "bevy_app")] -impl Plugin for TimeRunnerSystemsPlugin +impl Plugin for TimeRunnerPlugin where TimeCtx: Default + Send + Sync + 'static, { fn build(&self, app: &mut App) { + app.add_message::(); + + #[cfg(feature = "bevy_app")] app.configure_sets( self.schedule, ( @@ -154,6 +124,23 @@ where time_runner_system::.in_set(TimeRunnerSet::Progress), ), ); + + #[cfg(feature = "bevy_reflect")] + app.register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::(); + + #[cfg(feature = "debug")] + if self.enable_debug && !app.is_plugin_added::() { + app.add_plugins(TimeRunnerDebugPlugin::default()); + } } } From 1bde86e7615044a6c5380a80f3ec0288e5438622 Mon Sep 17 00:00:00 2001 From: Rabbival <87331993+Rabbival@users.noreply.github.com> Date: Sat, 21 Feb 2026 16:50:20 +0200 Subject: [PATCH 2/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f17426..d11ea6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Technically breaking (But hidden behind plugin): - Add `enable_debug` field to `TimeRunnerPlugin` by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) - Add `Tagging` variant to `TimeRunnerSet` by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) - - Systems now expected `TimeCtx` generic parameter by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) + - `TimeRunnerPlugin` now expected `TimeCtx` generic parameter by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) - Migrate to bevy 0.18 by [#16](https://github.com/Multirious/bevy_time_runner/pull/16) - Update flake by [#17](https://github.com/Multirious/bevy_time_runner/pull/17) From e061915bf8f87a838881330c197d043efcec915b Mon Sep 17 00:00:00 2001 From: Rabbival <87331993+Rabbival@users.noreply.github.com> Date: Sat, 21 Feb 2026 16:59:51 +0200 Subject: [PATCH 3/4] change linked pr in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d11ea6a..61939f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Technically breaking (But hidden behind plugin): - Add `enable_debug` field to `TimeRunnerPlugin` by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) - Add `Tagging` variant to `TimeRunnerSet` by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) - - `TimeRunnerPlugin` now expected `TimeCtx` generic parameter by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) + - `TimeRunnerPlugin` now expected `TimeCtx` generic parameter by [#19](https://github.com/Multirious/bevy_time_runner/pull/19) - Migrate to bevy 0.18 by [#16](https://github.com/Multirious/bevy_time_runner/pull/16) - Update flake by [#17](https://github.com/Multirious/bevy_time_runner/pull/17) From a4e0a880a06d3e4cd6b5c0290ea8fb238b70c370 Mon Sep 17 00:00:00 2001 From: Rabbival <87331993+Rabbival@users.noreply.github.com> Date: Sat, 21 Feb 2026 17:05:27 +0200 Subject: [PATCH 4/4] add back previous changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61939f7..34022ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Technically breaking (But hidden behind plugin): - Add `enable_debug` field to `TimeRunnerPlugin` by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) - Add `Tagging` variant to `TimeRunnerSet` by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) + - Systems now expected `TimeCtx` generic parameter by [#15](https://github.com/Multirious/bevy_time_runner/pull/15) - `TimeRunnerPlugin` now expected `TimeCtx` generic parameter by [#19](https://github.com/Multirious/bevy_time_runner/pull/19) - Migrate to bevy 0.18 by [#16](https://github.com/Multirious/bevy_time_runner/pull/16)