complete spatial indexing refactor - SpatialMap
This commit is contained in:
parent
2887bb9736
commit
d439ff6d3f
18 changed files with 351 additions and 217 deletions
|
|
@ -59,13 +59,12 @@ impl<'a> System<'a> for ChaseAI {
|
|||
&mut *map,
|
||||
);
|
||||
if path.success && path.steps.len() > 1 && path.steps.len() < MAX_CHASE_DISTANCE {
|
||||
let mut idx = map.xy_idx(pos.x, pos.y);
|
||||
map.blocked[idx] = false;
|
||||
let idx = map.xy_idx(pos.x, pos.y);
|
||||
pos.x = path.steps[1] as i32 % map.width;
|
||||
pos.y = path.steps[1] as i32 / map.width;
|
||||
entity_moved.insert(entity, EntityMoved {}).expect("Failed to insert EntityMoved");
|
||||
idx = map.xy_idx(pos.x, pos.y);
|
||||
map.blocked[idx] = true;
|
||||
let new_idx = map.xy_idx(pos.x, pos.y);
|
||||
crate::spatial::move_entity(entity, idx, new_idx);
|
||||
viewshed.dirty = true;
|
||||
if let Some(is_telepath) = telepaths.get_mut(entity) {
|
||||
is_telepath.dirty = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue