From 5762e627040dd89e314e6b45f2640a0b9dc2b75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Wed, 9 Aug 2023 15:53:16 +0000 Subject: [PATCH] Desert hum fix --- world/src/config.rs | 2 +- world/src/layer/scatter.rs | 56 +++++++++++-------------------------- world/src/layer/wildlife.rs | 6 ++-- 3 files changed, 20 insertions(+), 44 deletions(-) diff --git a/world/src/config.rs b/world/src/config.rs index 658ddb892f..ae75480214 100644 --- a/world/src/config.rs +++ b/world/src/config.rs @@ -65,7 +65,7 @@ pub const CONFIG: Config = Config { tropical_temp: 0.4, desert_temp: 0.8, // humidity - desert_hum: 0.0, + desert_hum: 0.15, forest_hum: 0.5, jungle_hum: 0.75, // water diff --git a/world/src/layer/scatter.rs b/world/src/layer/scatter.rs index 4b44057f6c..f676c75cb4 100644 --- a/world/src/layer/scatter.rs +++ b/world/src/layer/scatter.rs @@ -597,11 +597,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 0.1, None, ) @@ -613,11 +610,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 1.5, None, ) @@ -629,11 +623,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 2.0, None, ) @@ -645,11 +636,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 1.5, None, ) @@ -661,11 +649,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 2.0, None, ) @@ -677,11 +662,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 2.0, None, ) @@ -693,11 +675,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 2.0, None, ) @@ -709,11 +688,8 @@ pub fn apply_scatter_to(canvas: &mut Canvas, _rng: &mut impl Rng, calendar: Opti permit: |b| matches!(b, BlockKind::Grass), f: |_, col| { ( - close(col.temp, CONFIG.desert_temp, 0.25).min(close( - col.humidity, - CONFIG.desert_hum, - 0.1, - )) * MUSH_FACT + close(col.temp, CONFIG.desert_temp, 0.25).min(close(col.humidity, 0.0, 0.2)) + * MUSH_FACT * 2.0, None, ) diff --git a/world/src/layer/wildlife.rs b/world/src/layer/wildlife.rs index 69fdf5a91b..fc54128c74 100644 --- a/world/src/layer/wildlife.rs +++ b/world/src/layer/wildlife.rs @@ -447,7 +447,7 @@ pub fn spawn_manifest() -> Vec<(&'static str, DensityFn)> { // Rainforest area animals ("world.wildlife.spawn.tropical.rainforest", |c, _col| { close(c.temp, CONFIG.tropical_temp + 0.1, 0.4) - * close(c.humidity, CONFIG.desert_hum, 0.4) + * close(c.humidity, CONFIG.jungle_hum, 0.4) * BASE_DENSITY * 2.0 }), @@ -456,7 +456,7 @@ pub fn spawn_manifest() -> Vec<(&'static str, DensityFn)> { "world.wildlife.spawn.calendar.halloween.tropical.rainforest", |c, _col| { close(c.temp, CONFIG.tropical_temp + 0.1, 0.4) - * close(c.humidity, CONFIG.desert_hum, 0.4) + * close(c.humidity, CONFIG.jungle_hum, 0.4) * BASE_DENSITY * 2.0 }, @@ -465,7 +465,7 @@ pub fn spawn_manifest() -> Vec<(&'static str, DensityFn)> { "world.wildlife.spawn.calendar.april_fools.tropical.rainforest", |c, _col| { close(c.temp, CONFIG.tropical_temp + 0.1, 0.4) - * close(c.humidity, CONFIG.desert_hum, 0.4) + * close(c.humidity, CONFIG.jungle_hum, 0.4) * BASE_DENSITY * 2.0 },