Beginning the conversion to an Effects system

This commit is contained in:
Llywelwyn 2023-08-16 15:11:49 +01:00
parent a6690029e6
commit efe15705ad
13 changed files with 382 additions and 67 deletions

10
src/effects/targeting.rs Normal file
View file

@ -0,0 +1,10 @@
use crate::{Map, Position};
use specs::prelude::*;
pub fn entity_position(ecs: &World, target: Entity) -> Option<usize> {
if let Some(position) = ecs.read_storage::<Position>().get(target) {
let map = ecs.fetch::<Map>();
return Some(map.xy_idx(position.x, position.y));
}
return None;
}