taiga and savannah definitions

This commit is contained in:
Monty Marz 2021-08-02 20:31:25 +02:00 committed by Joshua Barretto
parent cb0f10b754
commit df0ab43bb8
3 changed files with 15 additions and 2 deletions

View File

@ -13,6 +13,8 @@ pub enum BiomeKind {
Swamp,
Jungle,
Forest,
Savannah,
Taiga,
}
impl Default for BiomeKind {

View File

@ -62,6 +62,7 @@ pub enum Spot {
//Swamp
//Jungle
//Forest
//Savannah
impl Spot {
pub fn generate(world: &mut WorldSim) {
@ -106,9 +107,9 @@ impl Spot {
&& !c.river.near_water()
&& !c.path.0.is_way()
&& c.sites.is_empty()
&& matches!(c.get_biome(), BiomeKind::Grassland)
&& matches!(c.get_biome(), BiomeKind::Savannah)
},
false,
true,
);
Self::generate_spots(
Spot::TreeStumpForest,

View File

@ -2378,6 +2378,8 @@ impl SimChunk {
pub fn get_base_z(&self) -> f32 { self.alt - self.chaos * 50.0 - 16.0 }
pub fn get_biome(&self) -> BiomeKind {
let savannah_hum_temp = [0.05..0.55, 0.3..1.6];
let taiga_hum_temp = [0.2..1.4, -0.7..-0.3];
if self.river.is_ocean() {
BiomeKind::Ocean
} else if self.river.is_lake() {
@ -2390,6 +2392,14 @@ impl SimChunk {
BiomeKind::Desert
} else if self.tree_density > 0.65 && self.humidity > 0.65 && self.temp > 0.45 {
BiomeKind::Jungle
} else if savannah_hum_temp[0].contains(&self.humidity)
&& savannah_hum_temp[1].contains(&self.temp)
{
BiomeKind::Savannah
} else if taiga_hum_temp[0].contains(&self.humidity)
&& taiga_hum_temp[1].contains(&self.temp)
{
BiomeKind::Taiga
} else if self.tree_density > 0.4 {
BiomeKind::Forest
// } else if self.humidity > 0.8 {