Beginning the conversion to an Effects system
This commit is contained in:
parent
a6690029e6
commit
efe15705ad
13 changed files with 382 additions and 67 deletions
10
src/effects/targeting.rs
Normal file
10
src/effects/targeting.rs
Normal 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue