Remove calls to \.single.

This commit is contained in:
Nolan Darilek 2022-02-01 08:41:27 -06:00
parent 7b1aaf69a2
commit 3cfb638b48
3 changed files with 34 additions and 31 deletions

View File

@ -265,7 +265,7 @@ fn exploration_focus<S, A: 'static>(
config.action_explore_right.clone(),
) {
for map in map.iter() {
let (entity, coordinates, exploring) = explorers.single();
if let Ok((entity, coordinates, exploring)) = explorers.get_single() {
let coordinates = **coordinates;
let mut exploring = if let Some(exploring) = exploring {
**exploring
@ -292,6 +292,7 @@ fn exploration_focus<S, A: 'static>(
}
}
}
}
}
fn navigate_to_explored<S, A: 'static>(

View File

@ -454,7 +454,6 @@ fn area_description(
})
{
if players.get(other).is_ok() {
let mut log = log.single_mut();
if let Ok((aabb, area_name)) = areas.get(area) {
let name = if let Some(name) = area_name {
Some(name.to_string())
@ -464,6 +463,7 @@ fn area_description(
None
};
if let Some(name) = name {
if let Ok(mut log) = log.get_single_mut() {
if event.intersecting {
log.push(format!("Entering {name}."));
} else {
@ -474,6 +474,7 @@ fn area_description(
}
}
}
}
}
pub struct MapPlugin;

View File

@ -379,7 +379,6 @@ fn log_visible(
continue;
}
if let Ok((name, body_position, collider_position)) = visible.get(*viewed) {
let mut log = log.single_mut();
let viewed_coordinates = if let Some(p) = body_position {
(p.position.translation.x, p.position.translation.y)
} else if let Some(p) = collider_position {
@ -391,8 +390,10 @@ fn log_visible(
let yaw = Angle::Radians(forward.y.atan2(forward.x));
let location =
viewer_coordinates.direction_and_distance(&viewed_coordinates, Some(yaw));
if let Ok(mut log) = log.get_single_mut() {
log.push(format!("{}: {location}", **name));
}
}
} else if let VisibilityChanged::Lost { viewed, .. } = event {
recently_lost.insert(*viewed, Timer::from_seconds(2., false));
}