···4455== Todo Info about derive macro.
6677-```rust no_run
88-use immediate_stats::*;
99-77+```rust
108#[derive(StatContainer)]
119struct Speed(Stat);
1210···2927There is build-in integration with the [Bevy Engine](https://bevyengine.org) via the `bevy` feature flag.
3028This adds systems for resetting `StatContainer` components and resources.
31293232-```rust ignore
3333-use bevy_app::prelude::*;
3434-use bevy_ecs::prelude::*;
3535-use immediate_stats::*;
3636-3030+```rust
3731#[derive(StatContainer, Component, Resource)]
3832struct Speed(Stat);
3933···5246If you use [Bevy Butler](https://github.com/TGRCdev/bevy-butler/), you can also use the `bevy_butler` feature flag.
5347This automatically registers the required system(s) using the `add_component` attribute.
54485555-```rust ignore
5656-use bevy_app::prelude::*;
5757-use bevy_ecs::prelude::*;
5858-use immediate_stats::*;
5959-use bevy_butler::*;
6060-4949+```rust
6150#[butler_plugin]
6251struct MyPlugin;
6352
+3-14
immediate_stats/README.md
···4455== Todo Info about derive macro.
6677-```rust no_run
88-use immediate_stats::*;
99-77+```rust
108#[derive(StatContainer)]
119struct Speed(Stat);
1210···2927There is build-in integration with the [Bevy Engine](https://bevyengine.org) via the `bevy` feature flag.
3028This adds systems for resetting `StatContainer` components and resources.
31293232-```rust ignore
3333-use bevy_app::prelude::*;
3434-use bevy_ecs::prelude::*;
3535-use immediate_stats::*;
3636-3030+```rust
3731#[derive(StatContainer, Component, Resource)]
3832struct Speed(Stat);
3933···5246If you use [Bevy Butler](https://github.com/TGRCdev/bevy-butler/), you can also use the `bevy_butler` feature flag.
5347This automatically registers the required system(s) using the `add_component` attribute.
54485555-```rust ignore
5656-use bevy_app::prelude::*;
5757-use bevy_ecs::prelude::*;
5858-use immediate_stats::*;
5959-use bevy_butler::*;
6060-4949+```rust
6150#[butler_plugin]
6251struct MyPlugin;
6352
+90-2
immediate_stats/src/lib.rs
···11-#![doc = include_str!("../README.md")]
11+//! Game stats that reset every frame.
22+//! Inspired by immediate mode rendering.
33+//!
44+//! == Todo Info about derive macro.
55+//! ```rust no_run
66+//! # use immediate_stats::*;
77+//! #[derive(StatContainer)]
88+//! struct Speed(Stat);
99+//!
1010+//! fn main() {
1111+//! loop {
1212+//! let mut speed = Speed(Stat::new(10)); // Set base speed to 10.
1313+//!
1414+//! speed.0 *= 2.0; // Applies a multiplier to the final result.
1515+//! speed.0 += 5; // Adds a bonus to the final result.
1616+//! // The order does not matter. Bonuses are always applied before multipliers.
1717+//! assert_eq!(speed.0.total(), 30); // (10 + 5) * 2 = 30
1818+//!
1919+//! speed.reset_modifiers(); // Reset bonus and multiplier, so speed is back to 10.
2020+//! }
2121+//! }
2222+//! ```
2323+//!
2424+//! ## Bevy
2525+//!
2626+//! There is build-in integration with the [Bevy Engine](https://bevyengine.org)
2727+//! via the `bevy` feature flag.
2828+//! This adds systems for resetting `StatContainer` components and resources.
2929+//!
3030+#![cfg_attr(not(feature = "bevy"), doc = "```rust ignore")]
3131+#![cfg_attr(feature = "bevy", doc = "```rust")]
3232+//! # use bevy_app::prelude::*;
3333+//! # use bevy_ecs::prelude::*;
3434+//! # use immediate_stats::*;
3535+//! #[derive(StatContainer, Component, Resource)]
3636+//! struct Speed(Stat);
3737+//!
3838+//! fn main() {
3939+//! App::new()
4040+//! .add_systems(PreUpdate, (
4141+//! reset_component_modifiers::<Speed>,
4242+//! reset_resource_modifiers::<Speed>,
4343+//! ))
4444+//! .run();
4545+//! }
4646+//! ```
4747+//!
4848+//! ### Bevy Butler
4949+//!
5050+//! If you use [Bevy Butler](https://github.com/TGRCdev/bevy-butler/),
5151+//! you can also use the `bevy_butler` feature flag.
5252+//! This automatically registers the required system(s) using the `add_component` attribute.
5353+//!
5454+#![cfg_attr(not(feature = "bevy_butler"), doc = "```rust ignore")]
5555+#![cfg_attr(feature = "bevy_butler", doc = "```rust")]
5656+//! use bevy_app::prelude::*;
5757+//! use bevy_ecs::prelude::*;
5858+//! use immediate_stats::*;
5959+//! use bevy_butler::*;
6060+//!
6161+//! #[butler_plugin]
6262+//! struct MyPlugin;
6363+//!
6464+//! #[derive(StatContainer, Component)]
6565+//! #[add_component(plugin = MyPlugin)] // Added by `StatContainer` derive.
6666+//! struct Speed(Stat);
6767+//! ```
6868+//!
6969+//! ### Version Compatibility
7070+//! | bevy | immediate_stats |
7171+//! |--------|-----------------|
7272+//! | `0.16` | `0.1` |
273374#[cfg(feature = "bevy")]
475pub mod bevy;
···59130/// assert_eq!(partial.ignored, Stat::new(1).with_bonus(10));
60131/// }
61132/// ```
133133+/// # Bevy Butler
134134+/// If the `bevy_butler` feature flag is enabled, you may also use the `add_component` attribute
135135+/// to register [`reset_component_modifiers`] and/or [`reset_resource_modifiers`] automatically.
136136+#[cfg_attr(not(feature = "bevy_butler"), doc = "```rust ignore")]
137137+#[cfg_attr(feature = "bevy_butler", doc = "```rust")]
138138+/// # use bevy_butler::*;
139139+/// # use bevy_ecs::prelude::*;
140140+/// # use immediate_stats::*;
141141+/// #[butler_plugin]
142142+/// struct MyPlugin;
143143+///
144144+/// #[derive(Component, StatContainer)]
145145+/// #[add_component(plugin = MyPlugin)]
146146+/// struct Speed(Stat);
147147+/// ```
62148pub use immediate_stats_macros::StatContainer;
63149pub use modifier::*;
64150pub use stat::*;
6515166152#[cfg(feature = "bevy")]
67153pub use bevy::*;
6868-#[cfg(feature = "bevy")] // Used by derive macro.
154154+155155+// Used by derive macro.
156156+#[cfg(feature = "bevy")]
69157#[doc(hidden)]
70158pub use bevy_app::prelude::PreUpdate;
71159