···4848}
4949```
50505151-### Bevy Butler
5151+### Bevy Auto Plugin
52525353-If you use [Bevy Butler](https://github.com/TGRCdev/bevy-butler/), you can also use the `bevy_butler` feature flag.
5454-This automatically registers the required system(s) using the `add_component` attribute
5555-or the existing `insert_resource` macro.
5353+If you use [Bevy Auto Plugin](https://github.com/strikeforcezero/bevy_auto_plugin/), you can also use the `bevy_auto_plugin` feature flag.
5454+This automatically registers the required system(s) by leveraging the existing `auto_component` and `auto_resource` macros.
56555756```rust
5857fn main() {
5958 App::new().add_plugins((ImmediateStatsPlugin, MyPlugin)).run();
6059}
61606262-#[butler_plugin]
6161+#[derive(AutoPlugin)]
6262+#[auto_plugin(impl_plugin_trait)]
6363struct MyPlugin;
64646565-// `StatContainer` derive adds the `add_component` attribute
6666-// and hooks into the existing `insert_resource` macro.
6565+// `StatContainer` derive hooks into the existing `auto_component` and `auto_resource` macros.
6766#[derive(StatContainer, Component, Resource)]
6868-#[add_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system.
6969-#[insert_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system.
6767+#[auto_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system.
6868+#[auto_init_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system.
7069struct Speed(Stat);
7170```
7271
···11+//! A very simple example using Bevy Auto Plugin. Requires the `bevy_auto_plugin` feature flag.
22+//! There are two other versions of this example, one using a simple main loop and the other using Bevy.
33+44+use bevy::prelude::*;
55+use bevy_auto_plugin;
66+use bevy_auto_plugin::modes::global::prelude::{AutoPlugin, auto_component, auto_system};
77+use immediate_stats::*;
88+99+fn main() {
1010+ App::new()
1111+ .add_plugins((MinimalPlugins, ImmediateStatsPlugin, SpeedPlugin))
1212+ .run();
1313+}
1414+1515+#[derive(AutoPlugin)]
1616+#[auto_plugin(impl_plugin_trait)]
1717+struct SpeedPlugin;
1818+1919+// Implements `reset_modifiers` by passing the call onto `Stat`.
2020+// This will also add the `ResetComponentPlugin` to `SpeedPlugin`.
2121+#[derive(StatContainer, Component)]
2222+#[auto_component(plugin = SpeedPlugin)]
2323+struct Speed(Stat);
2424+2525+#[auto_system(plugin = SpeedPlugin, schedule = Startup)]
2626+fn init_speed(mut commands: Commands) {
2727+ commands.spawn(Speed(Stat::new(10))); // Set base speed to 10.
2828+}
2929+3030+#[auto_system(plugin = SpeedPlugin, schedule = Update, config(in_set = StatSystems::Modify))]
3131+fn apply_modifiers(mut speeds: Query<&mut Speed>) {
3232+ for mut speed in &mut speeds {
3333+ speed.0 *= 2.0; // Applies a multiplier to the final result.
3434+ speed.0 += 5; // Adds a bonus to the final result.
3535+ // The order does not matter, bonuses are always applied before multipliers.
3636+ }
3737+}
3838+3939+#[auto_system(plugin = SpeedPlugin, schedule = Update, config(in_set = StatSystems::Read))]
4040+fn read_speed(speeds: Query<&Speed>) {
4141+ for speed in &speeds {
4242+ println!("The current speed is {}.", speed.0.total());
4343+ assert_eq!(speed.0.total(), 30); // (10 + 5) * 2 = 30
4444+ }
4545+}
+3-2
immediate_stats/examples/simple_bevy_butler.rs
···11-//! A very simple example using Bevy Butler. Requires the `bevy_butler` feature flag.
22-//! There are two other versions of this example, one using a simple main loop and the other using Bevy.
11+//! A very simple example using Bevy Butler. Requires the `bevy_butler` feature flag, which is *depreciated*.
22+//!
33+//! **Please see the Bevy Auto Plugin example instead.**
3445use bevy::prelude::*;
56use bevy_butler::*;
+1-1
immediate_stats/examples/simple_main_loop.rs
···11//! A very simple example using a main loop.
22-//! There are two other versions of this example, one using Bevy and the other using Bevy Butler.
22+//! There are two other versions of this example, one using Bevy and the other using Bevy Auto Plugin.
3344use immediate_stats::*;
55
+27-27
immediate_stats/src/lib.rs
···4848//! }
4949//! ```
5050//!
5151-//! ### Bevy Butler
5151+//! ### Bevy Auto Plugin
5252//!
5353-//! If you use [Bevy Butler](https://github.com/TGRCdev/bevy-butler/),
5454-//! you can also use the `bevy_butler` feature flag.
5555-//! This automatically registers the required system(s) using the `add_component` attribute
5656-//! or the existing `insert_resource` macro.
5353+//! If you use [Bevy Auto Plugin](https://github.com/strikeforcezero/bevy_auto_plugin/),
5454+//! you can also use the `bevy_auto_plugin` feature flag. This automatically registers the required
5555+//! system(s) by leveraging the existing `auto_component` and `auto_resource` macros.
5756//!
5858-#![cfg_attr(not(feature = "bevy_butler"), doc = "```rust ignore")]
5959-#![cfg_attr(feature = "bevy_butler", doc = "```rust")]
5757+#![cfg_attr(not(feature = "bevy_auto_plugin"), doc = "```rust ignore")]
5858+#![cfg_attr(feature = "bevy_auto_plugin", doc = "```rust")]
6059//! # use bevy_app::prelude::*;
6160//! # use bevy_ecs::prelude::*;
6261//! # use immediate_stats::*;
6363-//! # use bevy_butler::*;
6262+//! # use bevy_auto_plugin::modes::global::prelude::{AutoPlugin, auto_component, auto_resource};
6463//! fn main() {
6564//! App::new().add_plugins((ImmediateStatsPlugin, MyPlugin)).run();
6665//! }
6766//!
6868-//! #[butler_plugin]
6767+//! #[derive(AutoPlugin)]
6868+//! #[auto_plugin(impl_plugin_trait)]
6969//! struct MyPlugin;
7070//!
7171-//! // `StatContainer` derive adds the `add_component` attribute
7272-//! // and hooks into the existing `insert_resource` macro.
7373-//! #[derive(StatContainer, Component, Resource, Default)]
7474-//! #[add_component(plugin = MyPlugin)] // Adds `ResetComponentPlugin`
7575-//! #[insert_resource(plugin = MyPlugin)] // Adds `ResetResourcePlugin`
7171+//! // `StatContainer` derive hooks into the existing `auto_component` and `auto_resource` macros.
7272+//! #[derive(StatContainer, Component, Resource)]
7373+//! #[auto_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system.
7474+//! #[auto_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system.
7675//! struct Speed(Stat);
7776//! ```
7877//!
···141140/// assert_eq!(partial.ignored, Stat::default().with_bonus(10));
142141/// }
143142/// ```
144144-/// # Bevy Butler
145145-/// If the `bevy_butler` feature flag is enabled, you may also use the `add_component` attribute
146146-/// or the existing `insert_resource` macro to register [`reset_component_modifiers`]
147147-/// and/or [`reset_resource_modifiers`] automatically.
148148-#[cfg_attr(not(feature = "bevy_butler"), doc = "```rust ignore")]
149149-#[cfg_attr(feature = "bevy_butler", doc = "```rust")]
150150-/// # use bevy_butler::*;
143143+/// # Bevy Auto Plugin
144144+/// If the `bevy_auto_plugin` feature flag is enabled, the existing `auto_component` and
145145+/// `auto_resource` macros will register [`reset_component_modifiers`] and/or
146146+/// [`reset_resource_modifiers`] automatically.
147147+#[cfg_attr(not(feature = "bevy_auto_plugin"), doc = "```rust ignore")]
148148+#[cfg_attr(feature = "bevy_auto_plugin", doc = "```rust")]
149149+/// # use bevy_app::prelude::*;
151150/// # use bevy_ecs::prelude::*;
152151/// # use immediate_stats::*;
153153-/// #[butler_plugin]
152152+/// # use bevy_auto_plugin::modes::global::prelude::{AutoPlugin, auto_component, auto_resource};
153153+/// #[derive(AutoPlugin)]
154154+/// #[auto_plugin(impl_plugin_trait)]
154155/// struct MyPlugin;
155156///
156156-/// // `StatContainer` derive adds the `add_component` attribute
157157-/// // and hooks into the existing `insert_resource` macro.
158158-/// #[derive(StatContainer, Component, Resource, Default)]
159159-/// #[add_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system.
160160-/// #[insert_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system.
157157+/// // `StatContainer` derive hooks into the existing `auto_component` and `auto_resource` macros.
158158+/// #[derive(StatContainer, Component, Resource)]
159159+/// #[auto_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system.
160160+/// #[auto_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system.
161161/// struct Speed(Stat);
162162/// ```
163163pub use immediate_stats_macros::StatContainer;