use crate::{AddEffectCommand, Effecting};
use bevy_ecs::prelude::*;
use bevy_ecs::ptr::MovingPtr;
use bevy_ecs::spawn::SpawnableList;
#[doc = include_str!("../docs/effected_by_spawn_example.md")]
#[derive(Default)]
pub struct Effect<B: Bundle>(pub B);
impl<B: Bundle + Clone> SpawnableList<Effecting> for Effect<B> {
fn spawn(this: MovingPtr<'_, Self>, world: &mut World, target: Entity) {
let bundle = this.read();
world.commands().queue(AddEffectCommand {
target,
bundle: bundle.0,
});
}
fn size_hint(&self) -> usize {
0
}
}