···11#![cfg(feature = "bevy")]
22//! Contains systems and components for resetting [`StatContainer`]s in the Bevy game engine.
3344+#[cfg(feature = "bevy_auto_plugin")]
55+mod auto_plugin;
66+47use crate::StatContainer;
58use crate::modifier::Modifier;
69use crate::stat::Stat;
···1114use bevy_reflect::Reflect;
1215use bevy_reflect::prelude::ReflectDefault;
1316use std::marker::PhantomData;
1717+1818+#[cfg(feature = "bevy_auto_plugin")]
1919+pub use auto_plugin::*;
14201521/// Configures [system ordering](StatSystems) and registers types with the Bevy type registry.
1622///
+28
immediate_stats/src/bevy/auto_plugin.rs
···11+#![cfg(feature = "bevy_auto_plugin")]
22+//! Contains a hook for resetting [`StatContainer`]s using Bevy Auto Plugin.
33+44+use crate::{ResetComponentPlugin, ResetResourcePlugin, StatContainer};
55+use bevy_app::App;
66+use bevy_auto_plugin::prelude::AutoPluginBuildHook;
77+use bevy_ecs::component::Mutable;
88+use bevy_ecs::prelude::{Component, Resource};
99+1010+/// A Bevy Auto Plugin hook that adds the [`ResetComponentPlugin`] for the component.
1111+pub struct ResetComponentHook;
1212+1313+impl<T: Component<Mutability = Mutable> + StatContainer + 'static> AutoPluginBuildHook<T>
1414+ for ResetComponentHook
1515+{
1616+ fn on_build(&self, app: &mut App) {
1717+ app.add_plugins(ResetComponentPlugin::<T>::new());
1818+ }
1919+}
2020+2121+/// A Bevy Auto Plugin hook that adds the [`ResetResourcePlugin`] for the resource.
2222+pub struct ResetResourceHook;
2323+2424+impl<T: Resource + StatContainer + 'static> AutoPluginBuildHook<T> for ResetResourceHook {
2525+ fn on_build(&self, app: &mut App) {
2626+ app.add_plugins(ResetResourcePlugin::<T>::new());
2727+ }
2828+}