use ::specs::prelude::*; use super::{EffectSpawner, EffectType}; use crate::map::Map; use crate::particle_system::ParticleBuilder; pub fn particle_to_tile(ecs: &mut World, tile_idx: i32, effect: &EffectSpawner) { if let EffectType::Particle { glyph, fg, bg, lifespan, } = effect.effect_type { let map = ecs.fetch::(); let mut particle_builder = ecs.fetch_mut::(); particle_builder.request( tile_idx % map.width, tile_idx / map.width, fg, bg, glyph, lifespan, ); } }