atomising item use: hunger effect

This commit is contained in:
Llywelwyn 2023-08-17 01:16:35 +01:00
parent 18eae23a4c
commit 931f600625
13 changed files with 455 additions and 360 deletions

View file

@ -8,3 +8,13 @@ pub fn entity_position(ecs: &World, target: Entity) -> Option<usize> {
}
return None;
}
pub fn aoe_tiles(map: &Map, target: rltk::Point, radius: i32) -> Vec<usize> {
let mut blast_tiles = rltk::field_of_view(target, radius, &*map);
blast_tiles.retain(|p| p.x > 0 && p.x < map.width - 1 && p.y > 0 && p.y < map.height - 1);
let mut result = Vec::new();
for t in blast_tiles.iter() {
result.push(map.xy_idx(t.x, t.y));
}
result
}