mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
add fn generate_forest in namegen to name forest biomes
This commit is contained in:
parent
5ad8501cc8
commit
c00f5bafee
@ -523,11 +523,20 @@ impl Civs {
|
||||
.iter()
|
||||
.min_by_key(|&b| center.distance_squared(uniform_idx_as_vec2(map_size_lg, *b)))
|
||||
.unwrap();
|
||||
let name = format!(
|
||||
"{} {:?}",
|
||||
NameGen::location(&mut ctx.rng).generate_biome(),
|
||||
biome.0
|
||||
);
|
||||
let name = match biome.0 {
|
||||
common::terrain::BiomeKind::Forest => format!("{}\n{:?}", NameGen::location(&mut ctx.rng).generate_forest(), biome.0),
|
||||
common::terrain::BiomeKind::Grassland
|
||||
|common::terrain::BiomeKind::Lake
|
||||
| common::terrain::BiomeKind::Ocean
|
||||
| common::terrain::BiomeKind::Mountain
|
||||
| common::terrain::BiomeKind::Snowland
|
||||
| common::terrain::BiomeKind::Desert
|
||||
| common::terrain::BiomeKind::Swamp
|
||||
| common::terrain::BiomeKind::Jungle
|
||||
| common::terrain::BiomeKind::Savannah
|
||||
| common::terrain::BiomeKind::Taiga => format!("{}\n{:?}", NameGen::location(&mut ctx.rng).generate_biome(), biome.0),
|
||||
_ => String::new()
|
||||
};
|
||||
let id = self.pois.insert(PointOfInterest {
|
||||
name,
|
||||
loc: uniform_idx_as_vec2(map_size_lg, idx),
|
||||
|
@ -89,4 +89,26 @@ impl<'a, R: Rng> NameGen<'a, R> {
|
||||
.map(|(i, c)| if i == 0 { c.to_ascii_uppercase() } else { c })
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn generate_forest(self) -> String {
|
||||
let cons = vec![
|
||||
"green", "moss", "ever", "briar", "thorn", "oak", "deep", "moon", "star", "sun", "bright", "glare",
|
||||
"fair", "calm", "mistral", "whisper", "clover", "hollow", "spring", "morrow", "dim", "dusk", "dawn", "night",
|
||||
"shimmer", "silver", "gold", "whisper", "fern", "quiet", "still", "gleam", "wild", "blind", "swift",
|
||||
];
|
||||
let start = cons.clone();
|
||||
let end = vec![
|
||||
"root", "bark", "log", "brook", "well", "shire", "leaf", "more", "bole", "heart", "song", "dew",
|
||||
"bough", "path", "wind", "breeze", "light", "branch", "bloom", "vale", "glen", "rest", "shade",
|
||||
"fall", "sward", "thicket", "shrub", "bush", "grasp", "grip", "gale", "crawl", "run", "shadow",
|
||||
];
|
||||
let mut name = String::new();
|
||||
name += start.choose(self.rng).unwrap();
|
||||
name += end.choose(self.rng).unwrap();
|
||||
|
||||
name.chars()
|
||||
.enumerate()
|
||||
.map(|(i, c)| if i == 0 { c.to_ascii_uppercase() } else { c })
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user