Floor coordinates so directions are consistent.

This commit is contained in:
Nolan Darilek 2021-09-27 09:57:21 -05:00
parent ef35478b34
commit 2ac2566f5d

View File

@ -202,7 +202,10 @@ where
}
}
if let Some((coordinates, _)) = target {
commands.entity(entity).insert(Exploring(***coordinates));
commands.entity(entity).insert(Exploring((
coordinates.x().floor(),
coordinates.y().floor(),
)));
}
}
}
@ -264,7 +267,7 @@ fn exploration_focus<S, A: 'static>(
let mut exploring = if let Some(exploring) = exploring {
**exploring
} else {
coordinates
(coordinates.x().floor(), coordinates.y().floor())
};
let orig = exploring;
if input.just_active(explore_forward.clone()) {
@ -330,7 +333,7 @@ fn exploration_changed_announcement(
if let Ok((coordinates, exploring)) = explorer.single() {
let collider_set = QueryPipelineColliderComponentsSet(&collider_query);
let coordinates = **coordinates;
let coordinates = (coordinates.0.floor(), coordinates.1.floor());
let coordinates = (coordinates.x().floor(), coordinates.y().floor());
for (map, revealed_tiles, visible_tiles) in map.iter() {
let point = **exploring;
let idx = point.to_index(map.width);