From 4d5b5c67b369b9c0f67021e8527395518f990a12 Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Tue, 29 Aug 2023 11:13:51 -0400 Subject: [PATCH] Clean up plugin-related code (#37) * Remove AbilityPlugin::server Fixes #14 * Use a more helpful name for the run condition --- RELEASES.md | 6 ++++++ src/plugin.rs | 16 +--------------- src/systems.rs | 2 +- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 216ae09..c78cea2 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,5 +1,11 @@ # Release Notes +## Version 0.6 + +### Usability + +- removed the useless `AbilityPlugin::server()` plugin creation method + ## Version 0.5 - now supports Bevy 0.11 diff --git a/src/plugin.rs b/src/plugin.rs index 84d3826..24bd30d 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -52,20 +52,6 @@ impl Default for AbilityPlugin { } } -impl AbilityPlugin { - /// Creates a version of the plugin intended to run on the server - /// - /// Inputs will not be processed; instead, [`ActionState`](crate::action_state::ActionState) - /// should be copied directly from the state provided by the client, - /// or constructed from [`ActionDiff`](crate::action_state::ActionDiff) event streams. - #[must_use] - pub fn server() -> Self { - Self { - _phantom: PhantomData, - } - } -} - impl Plugin for AbilityPlugin { fn build(&self, app: &mut App) { use crate::systems::*; @@ -74,7 +60,7 @@ impl Plugin for AbilityPlugin { app.add_systems( PreUpdate, tick_cooldowns:: - .run_if(run_if_enabled::) + .run_if(actions_toggled::) .in_set(InputManagerSystem::Tick) .before(InputManagerSystem::Update), ); diff --git a/src/systems.rs b/src/systems.rs index 9ce974b..94ec088 100644 --- a/src/systems.rs +++ b/src/systems.rs @@ -54,6 +54,6 @@ pub fn regenerate_resource_pool( } /// Returns [`ShouldRun::No`] if [`DisableInput`] exists and [`ShouldRun::Yes`] otherwise -pub(super) fn run_if_enabled(toggle_actions: Res>) -> bool { +pub(super) fn actions_toggled(toggle_actions: Res>) -> bool { toggle_actions.enabled }