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.

More docs on merge functions.

+7 -2
+7 -2
src/registry.rs
··· 5 5 /// A function used to merge effects with [`EffectMode::Merge`](crate::EffectMode::Merge), 6 6 /// which must be registered in the [registry](EffectMergeRegistry). 7 7 /// 8 + /// The component the function is registered for is guaranteed to exist on both provided entities. 9 + /// Note that the incoming entity exists in a **separate world**. 10 + /// 8 11 /// # Example 9 12 /// ```rust 10 13 /// # use bevy_ecs::prelude::*; ··· 13 16 /// struct MyEffect(f32); 14 17 /// 15 18 /// fn merge_my_effect(mut existing: EntityWorldMut, incoming: EntityRef) { 19 + /// let mut existing = existing.get_mut::<MyEffect>().unwrap(); 16 20 /// let incoming = incoming.get::<MyEffect>().unwrap(); 17 - /// existing.get_mut::<MyEffect>().unwrap().0 += incoming.0; 21 + /// existing.0 += incoming.0; 18 22 /// } 19 23 /// ``` 20 24 pub type EffectMergeFn = fn(existing: EntityWorldMut, incoming: EntityRef); ··· 38 42 /// } 39 43 /// 40 44 /// fn merge_my_effect(mut existing: EntityWorldMut, incoming: EntityRef) { 45 + /// let mut existing = existing.get_mut::<MyEffect>().unwrap(); 41 46 /// let incoming = incoming.get::<MyEffect>().unwrap(); 42 - /// existing.get_mut::<MyEffect>().unwrap().0 += incoming.0; 47 + /// existing.0 += incoming.0; 43 48 /// } 44 49 /// ``` 45 50 #[derive(Resource, Default)]