Assorted small changes.

This commit is contained in:
Nolan Darilek 2022-01-13 14:43:02 -06:00
parent 10bf503c89
commit a214206caf
4 changed files with 72 additions and 69 deletions

View File

@ -333,7 +333,7 @@ fn exploration_changed_announcement(
query_pipeline: Res<QueryPipeline>,
collider_query: QueryPipelineColliderComponentsQuery,
) -> Result<(), Box<dyn Error>> {
let (coordinates, exploring, viewshed) = explorer.single();
if let Ok((coordinates, exploring, viewshed)) = explorer.get_single() {
let collider_set = QueryPipelineColliderComponentsSet(&collider_query);
let coordinates = coordinates.floor();
for (map, revealed_tiles) in map.iter() {
@ -393,6 +393,7 @@ fn exploration_changed_announcement(
}
tts.speak(tokens.join(", ").to_string(), true)?;
}
}
Ok(())
}

View File

@ -22,8 +22,8 @@ impl From<mapgen::geometry::Point> for Coordinates {
}
}
#[derive(Component, Clone, Debug, Deref, DerefMut)]
pub struct Area(AABB);
#[derive(Component, Copy, Clone, Debug, Deref, DerefMut, PartialEq)]
pub struct Area(pub AABB);
#[derive(Component, Clone, Default, Deref, DerefMut)]
pub struct Map(pub MapgenMap);

View File

@ -195,9 +195,10 @@ fn speak_direction(
mut tts: ResMut<Tts>,
player: Query<&CardinalDirection, (With<Player>, Changed<CardinalDirection>)>,
) -> Result<(), Box<dyn Error>> {
let direction = player.single();
if let Ok(direction) = player.get_single() {
let direction: String = (*direction).into();
tts.speak(direction, true)?;
}
Ok(())
}

View File

@ -281,7 +281,7 @@ fn update_viewshed(
if let Ok((viewer_entity, mut viewshed, mut visible_entities, viewer_coordinates)) =
viewers.get_mut(*entity)
{
let map = map.single();
if let Ok(map) = map.get_single() {
let mut cache = HashMap::new();
viewshed.update(
&viewer_entity,
@ -297,6 +297,7 @@ fn update_viewshed(
}
}
}
}
fn remove_visible(
removed: RemovedComponents<Visible>,