More robust area descriptions.
This commit is contained in:
parent
9a2495d9de
commit
a591326734
21
src/map.rs
21
src/map.rs
|
@ -445,7 +445,6 @@ fn area_description(
|
|||
mut log: Query<&mut Log>,
|
||||
) {
|
||||
for event in events.iter() {
|
||||
if event.intersecting {
|
||||
if let Some((area, other)) =
|
||||
target_and_other(event.collider1.entity(), event.collider2.entity(), &|v| {
|
||||
areas.get(v).is_ok()
|
||||
|
@ -453,17 +452,23 @@ fn area_description(
|
|||
{
|
||||
if players.get(other).is_ok() {
|
||||
if let Ok(mut log) = log.single_mut() {
|
||||
if let Ok(name) = names.get(area) {
|
||||
log.push(name.to_string());
|
||||
let name = if let Ok(name) = names.get(area) {
|
||||
Some(name.to_string())
|
||||
} else if config.describe_undescribed_areas {
|
||||
if let Ok(shape) = shapes.get(area) {
|
||||
let aabb = shape.compute_local_aabb();
|
||||
log.push(format!(
|
||||
"{}-by-{} area",
|
||||
aabb.extents().x,
|
||||
aabb.extents().y
|
||||
));
|
||||
Some(format!("{}-by-{} area", aabb.extents().x, aabb.extents().y))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let Some(name) = name {
|
||||
if event.intersecting {
|
||||
log.push(format!("Entering {}.", name));
|
||||
} else {
|
||||
log.push(format!("Leaving {}.", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user