@@ -123,57 +123,6 @@ pub trait Condition<Marker, In: SystemInput = ()>: sealed::Condition<Marker, In>
123123 CombinatorSystem :: new ( a, b, Cow :: Owned ( name) )
124124 }
125125
126- /// Returns a new run condition that only returns `true`
127- /// if both this one and the passed `and_then` return `true`.
128- ///
129- /// The returned run condition is short-circuiting, meaning
130- /// `and_then` will only be invoked if `self` returns `true`.
131- ///
132- /// # Examples
133- ///
134- /// ```
135- /// use bevy_ecs::prelude::*;
136- ///
137- /// #[derive(Resource, PartialEq)]
138- /// struct R(u32);
139- ///
140- /// # let mut app = Schedule::default();
141- /// # let mut world = World::new();
142- /// # fn my_system() {}
143- /// app.add_systems(
144- /// // The `resource_equals` run condition will fail since we don't initialize `R`,
145- /// // just like if we used `Res<R>` in a system.
146- /// my_system.run_if(resource_equals(R(0))),
147- /// );
148- /// # app.run(&mut world);
149- /// ```
150- ///
151- /// Use `.and_then()` to avoid checking the condition.
152- ///
153- /// ```
154- /// # use bevy_ecs::prelude::*;
155- /// # #[derive(Resource, PartialEq)]
156- /// # struct R(u32);
157- /// # let mut app = Schedule::default();
158- /// # let mut world = World::new();
159- /// # fn my_system() {}
160- /// app.add_systems(
161- /// // `resource_equals` will only get run if the resource `R` exists.
162- /// my_system.run_if(resource_exists::<R>.and_then(resource_equals(R(0)))),
163- /// );
164- /// # app.run(&mut world);
165- /// ```
166- ///
167- /// Note that in this case, it's better to just use the run condition [`resource_exists_and_equals`].
168- ///
169- /// [`resource_exists_and_equals`]: common_conditions::resource_exists_and_equals
170- #[ deprecated(
171- note = "Users should use the `.and(condition)` method in lieu of `.and_then(condition)`"
172- ) ]
173- fn and_then < M , C : Condition < M , In > > ( self , and_then : C ) -> And < Self :: System , C :: System > {
174- self . and ( and_then)
175- }
176-
177126 /// Returns a new run condition that only returns `false`
178127 /// if both this one and the passed `nand` return `true`.
179128 ///
@@ -325,53 +274,6 @@ pub trait Condition<Marker, In: SystemInput = ()>: sealed::Condition<Marker, In>
325274 CombinatorSystem :: new ( a, b, Cow :: Owned ( name) )
326275 }
327276
328- /// Returns a new run condition that returns `true`
329- /// if either this one or the passed `or` return `true`.
330- ///
331- /// The returned run condition is short-circuiting, meaning
332- /// `or` will only be invoked if `self` returns `false`.
333- ///
334- /// # Examples
335- ///
336- /// ```
337- /// use bevy_ecs::prelude::*;
338- ///
339- /// #[derive(Resource, PartialEq)]
340- /// struct A(u32);
341- ///
342- /// #[derive(Resource, PartialEq)]
343- /// struct B(u32);
344- ///
345- /// # let mut app = Schedule::default();
346- /// # let mut world = World::new();
347- /// # #[derive(Resource)] struct C(bool);
348- /// # fn my_system(mut c: ResMut<C>) { c.0 = true; }
349- /// app.add_systems(
350- /// // Only run the system if either `A` or `B` exist.
351- /// my_system.run_if(resource_exists::<A>.or(resource_exists::<B>)),
352- /// );
353- /// #
354- /// # world.insert_resource(C(false));
355- /// # app.run(&mut world);
356- /// # assert!(!world.resource::<C>().0);
357- /// #
358- /// # world.insert_resource(A(0));
359- /// # app.run(&mut world);
360- /// # assert!(world.resource::<C>().0);
361- /// #
362- /// # world.remove_resource::<A>();
363- /// # world.insert_resource(B(0));
364- /// # world.insert_resource(C(false));
365- /// # app.run(&mut world);
366- /// # assert!(world.resource::<C>().0);
367- /// ```
368- #[ deprecated(
369- note = "Users should use the `.or(condition)` method in lieu of `.or_else(condition)`"
370- ) ]
371- fn or_else < M , C : Condition < M , In > > ( self , or_else : C ) -> Or < Self :: System , C :: System > {
372- self . or ( or_else)
373- }
374-
375277 /// Returns a new run condition that only returns `true`
376278 /// if `self` and `xnor` **both** return `false` or **both** return `true`.
377279 ///
@@ -1406,7 +1308,6 @@ mod tests {
14061308 }
14071309
14081310 #[ test]
1409- #[ allow( deprecated) ]
14101311 fn run_condition_combinators ( ) {
14111312 let mut world = World :: new ( ) ;
14121313 world. init_resource :: < Counter > ( ) ;
@@ -1415,23 +1316,21 @@ mod tests {
14151316 schedule. add_systems (
14161317 (
14171318 increment_counter. run_if ( every_other_time. and ( || true ) ) , // Run every odd cycle.
1418- increment_counter. run_if ( every_other_time. and_then ( || true ) ) , // Run every odd cycle.
1419- increment_counter. run_if ( every_other_time. nand ( || false ) ) , // Always run.
1420- double_counter. run_if ( every_other_time. nor ( || false ) ) , // Run every even cycle.
1421- increment_counter. run_if ( every_other_time. or ( || true ) ) , // Always run.
1422- increment_counter. run_if ( every_other_time. or_else ( || true ) ) , // Always run.
1319+ increment_counter. run_if ( every_other_time. nand ( || false ) ) , // Always run.
1320+ double_counter. run_if ( every_other_time. nor ( || false ) ) , // Run every even cycle.
1321+ increment_counter. run_if ( every_other_time. or ( || true ) ) , // Always run.
14231322 increment_counter. run_if ( every_other_time. xnor ( || true ) ) , // Run every odd cycle.
1424- double_counter. run_if ( every_other_time. xnor ( || false ) ) , // Run every even cycle.
1323+ double_counter. run_if ( every_other_time. xnor ( || false ) ) , // Run every even cycle.
14251324 increment_counter. run_if ( every_other_time. xor ( || false ) ) , // Run every odd cycle.
1426- double_counter. run_if ( every_other_time. xor ( || true ) ) , // Run every even cycle.
1325+ double_counter. run_if ( every_other_time. xor ( || true ) ) , // Run every even cycle.
14271326 )
14281327 . chain ( ) ,
14291328 ) ;
14301329
14311330 schedule. run ( & mut world) ;
1432- assert_eq ! ( world. resource:: <Counter >( ) . 0 , 7 ) ;
1331+ assert_eq ! ( world. resource:: <Counter >( ) . 0 , 5 ) ;
14331332 schedule. run ( & mut world) ;
1434- assert_eq ! ( world. resource:: <Counter >( ) . 0 , 72 ) ;
1333+ assert_eq ! ( world. resource:: <Counter >( ) . 0 , 52 ) ;
14351334 }
14361335
14371336 #[ test]
0 commit comments