From 642342d2c8142218fef8c2d28f42bfcc433c3fc1 Mon Sep 17 00:00:00 2001 From: L Date: Fri, 29 Dec 2023 10:55:38 -0500 Subject: [PATCH] fix compilation issues --- crates/bevy_ecs/macros/src/lib.rs | 1 - crates/bevy_ecs/src/schedule/state.rs | 9 +------ .../bevy_ecs/src/schedule/state_matching.rs | 4 +++ examples/ecs/black_box_state.rs | 26 +++++++++---------- examples/ecs/nested_state.rs | 26 +++++++++---------- examples/ecs/state.rs | 16 ++++++------ examples/ecs/state_transitions.rs | 2 +- examples/ecs/struct_state.rs | 26 +++++++++---------- 8 files changed, 53 insertions(+), 57 deletions(-) diff --git a/crates/bevy_ecs/macros/src/lib.rs b/crates/bevy_ecs/macros/src/lib.rs index d975de569a524..8c2022ba96ca7 100644 --- a/crates/bevy_ecs/macros/src/lib.rs +++ b/crates/bevy_ecs/macros/src/lib.rs @@ -1,7 +1,6 @@ extern crate proc_macro; mod component; -mod fetch; mod state_matchers; mod query_data; mod query_filter; diff --git a/crates/bevy_ecs/src/schedule/state.rs b/crates/bevy_ecs/src/schedule/state.rs index ee0fbda5672d5..3e9c00b017556 100644 --- a/crates/bevy_ecs/src/schedule/state.rs +++ b/crates/bevy_ecs/src/schedule/state.rs @@ -4,7 +4,6 @@ use std::mem; use std::ops::Deref; use crate as bevy_ecs; -use crate::change_detection::DetectChangesMut; use crate::prelude::FromWorld; #[cfg(feature = "bevy_reflect")] use crate::reflect::ReflectResource; @@ -208,7 +207,7 @@ impl Deref for State { /// To queue a transition, just set the contained value to `Some(next_state)`. /// Note that these transitions can be overridden by other systems: /// only the actual value of this resource at the time of [`apply_state_transition`] matters. -#[derive(Resource, Debug)] +#[derive(Resource, Debug, Default)] #[cfg_attr( feature = "bevy_reflect", derive(bevy_reflect::Reflect), @@ -274,12 +273,6 @@ impl Debug for NextState { } } -impl Default for NextState { - fn default() -> Self { - Self(None) - } -} - impl NextState { /// Tentatively set a planned state transition to `Some(state)`. pub fn set(&mut self, state: S) { diff --git a/crates/bevy_ecs/src/schedule/state_matching.rs b/crates/bevy_ecs/src/schedule/state_matching.rs index a455b38d4d4c7..4bff062e5cc83 100644 --- a/crates/bevy_ecs/src/schedule/state_matching.rs +++ b/crates/bevy_ecs/src/schedule/state_matching.rs @@ -538,6 +538,10 @@ impl> System for StateMatcherSyste fn set_last_run(&mut self, last_run: crate::component::Tick) { self.0.set_last_run(last_run); } + + fn has_deferred(&self) -> bool { + false + } } /// SAFETY: The boxed system is must be a read only system diff --git a/examples/ecs/black_box_state.rs b/examples/ecs/black_box_state.rs index 071916461b188..e48835f71817b 100644 --- a/examples/ecs/black_box_state.rs +++ b/examples/ecs/black_box_state.rs @@ -16,7 +16,7 @@ fn main() { .add_plugins(DefaultPlugins) .add_systems(Update, toggle_pause) .add_systems(Startup, setup) - .add_state::() + .init_state::() // Because we can't really see the internals of `AppState`, we need to rely on matching functions exported from // the `state` module. Fortunately, we can use these with the `entering`/`exiting`/`transitioning` functions! // Here we are using the `in_menu` function, which uses a derive to match any state with `in_menu: true` @@ -303,21 +303,21 @@ fn setup_game( const SPEED: f32 = 100.0; fn movement( time: Res