An experimental, status effects-as-entities system for Bevy.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update documentation.

+11 -21
+6 -10
README.md
··· 9 9 ### Applying Effects 10 10 Effects can be applied using `with_effect` or `with_effects` (similar to `with_child` and `with_children` respectively). 11 11 ```rust ignore 12 - commands.entity(target).with_effect(EffectBundle { 13 - name: Name::new("Effect"), 14 - bundle: MyEffect, 15 - ..default() 16 - }); 12 + commands.entity(target).with_effect((Name::new("Effect"), MyEffect)); 17 13 ``` 18 14 They can also be added using spawn-style syntax. 19 15 ```rust ignore 20 16 commands.spawn(( 21 17 Name::new("Target"), 22 - EffectedBy::spawn(EffectBundle { 23 - name: Name::new("Effect"), 24 - bundle: MyEffect, 25 - ..default() 26 - }), 18 + EffectedBy::spawn( 19 + Effect((Name::new("Effect"), MyEffect)) 20 + ), 27 21 )); 28 22 ``` 23 + 24 + Note that these methods *might* spawn a new entity, depending on what effects are already applied to the target. 29 25 30 26 ### Effect Modes 31 27 For some effects it makes sense to allow stacking, so a single entity could be effected by an effect multiple times.
+1 -1
src/command.rs
··· 177 177 #[doc = include_str!("../docs/with_effect_example.md")] 178 178 fn with_effect<B: Bundle + Clone>(&mut self, bundle: B) -> &mut Self; 179 179 180 - /// Applies effects to this entity by taking a function that operates on a [`EffectSpawner`]. 180 + /// Applies effects to this entity by taking a function that operates on an [`EffectSpawner`]. 181 181 /// 182 182 /// For applying a single effect, see [`with_effect`](Self::with_effect). 183 183 ///
+4 -10
src/spawnable_list.rs
··· 3 3 use bevy_ecs::ptr::MovingPtr; 4 4 use bevy_ecs::spawn::SpawnableList; 5 5 6 - /// A "bundle" of components/settings used when applying an effect. 7 - /// Due to technical limitations, this doesn't actually implement [`Bundle`]. 8 - /// Instead, purpose build commands ([`with_effect`](crate::command::EffectCommandsExt::with_effect)) 9 - /// or related spawners ([`EffectedBy::spawn`](SpawnRelated::spawn)) should be used. 6 + /// A wrapper over a [`Bundle`] indicating that an effect should be applied with that [`Bundle`]. 7 + /// This is intended to be used in [`EffectedBy::spawn`](SpawnRelated::spawn). 10 8 /// 11 - /// # Examples 12 - /// ### [`with_effect`](crate::command::EffectCommandsExt::with_effect) 13 - #[doc = include_str!("../docs/with_effect_example.md")] 14 - /// ### [`with_effects`](crate::command::EffectCommandsExt::with_effects) + [`EffectSpawner`](crate::command::EffectSpawner) 15 - #[doc = include_str!("../docs/with_effects_example.md")] 16 - /// ### [`EffectedBy::spawn`](SpawnRelated::spawn) 9 + /// This *might* spawn a new entity, depending on what effects are already applied to the target. 10 + /// # Example 17 11 #[doc = include_str!("../docs/effected_by_spawn_example.md")] 18 12 #[derive(Default)] 19 13 pub struct Effect<B: Bundle>(pub B);