Make describing undescribed areas configurable.
This commit is contained in:
parent
3332d0a88d
commit
64e763a840
19
src/map.rs
19
src/map.rs
|
@ -84,6 +84,7 @@ impl ITileType for TileType {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct MapConfig {
|
pub struct MapConfig {
|
||||||
pub autospawn_exits: bool,
|
pub autospawn_exits: bool,
|
||||||
|
pub describe_undescribed_areas: bool,
|
||||||
pub speak_area_descriptions: bool,
|
pub speak_area_descriptions: bool,
|
||||||
pub start_revealed: bool,
|
pub start_revealed: bool,
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,7 @@ impl Default for MapConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
autospawn_exits: true,
|
autospawn_exits: true,
|
||||||
|
describe_undescribed_areas: false,
|
||||||
speak_area_descriptions: true,
|
speak_area_descriptions: true,
|
||||||
start_revealed: false,
|
start_revealed: false,
|
||||||
}
|
}
|
||||||
|
@ -263,6 +265,7 @@ fn exit_spawner(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn area_description(
|
fn area_description(
|
||||||
|
config: Res<MapConfig>,
|
||||||
mut prev_area: Local<Option<Area>>,
|
mut prev_area: Local<Option<Area>>,
|
||||||
query: Query<(&Player, &Coordinates), Changed<Coordinates>>,
|
query: Query<(&Player, &Coordinates), Changed<Coordinates>>,
|
||||||
map: Query<(&Map, &Areas)>,
|
map: Query<(&Map, &Areas)>,
|
||||||
|
@ -288,12 +291,20 @@ fn area_description(
|
||||||
if should_describe_area {
|
if should_describe_area {
|
||||||
if let Some(ref area) = current_area {
|
if let Some(ref area) = current_area {
|
||||||
let description = if area.description.is_some() {
|
let description = if area.description.is_some() {
|
||||||
area.description.as_ref().unwrap().clone()
|
area.description.clone()
|
||||||
|
} else if config.describe_undescribed_areas {
|
||||||
|
Some(format!(
|
||||||
|
"{} by {} area.",
|
||||||
|
area.rect.width(),
|
||||||
|
area.rect.height()
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
format!("{} by {} area.", area.rect.width(), area.rect.height())
|
None
|
||||||
};
|
};
|
||||||
for mut log in log.iter_mut() {
|
if let Some(description) = description {
|
||||||
log.push(description.clone());
|
for mut log in log.iter_mut() {
|
||||||
|
log.push(description.clone());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user