diff --git a/world/src/block/mod.rs b/world/src/block/mod.rs index a57e3973fd..62792a9abb 100644 --- a/world/src/block/mod.rs +++ b/world/src/block/mod.rs @@ -121,7 +121,7 @@ impl<'a> BlockGen<'a> { if stone_factor >= 0.5 { if wposf.z as f32 > height - cliff_offset.max(0.0) { - if cliff_offset.max(0.0) > cliff_height - (FastNoise::new(37).get(wposf / Vec3::new(6.0, 6.0, 10.0)) * 0.5 + 0.5) * (height - wposf.z as f32).mul(0.25).clamped(0.0, 12.0) { + if cliff_offset.max(0.0) > cliff_height - (FastNoise::new(37).get(wposf / Vec3::new(6.0, 6.0, 10.0)) * 0.5 + 0.5) * (height - wposf.z as f32).mul(0.25).clamped(0.0, 10.0) { Some(Block::empty()) } else { let col = Lerp::lerp( diff --git a/world/src/column/mod.rs b/world/src/column/mod.rs index 34dcbf3ee1..813478b488 100644 --- a/world/src/column/mod.rs +++ b/world/src/column/mod.rs @@ -267,9 +267,9 @@ impl<'a> Sampler<'a> for ColumnGen<'a> { // Cliffs let cliff_height = - sim.get_interpolated(wpos, |chunk| chunk.cliff_height)? * (1.0 - near_water).powf(2.0); + sim.get_interpolated(wpos, |chunk| chunk.cliff_height)?; let cliff_factor = (alt - + self.sim.gen_ctx.hill_nz.get(wposf.div(32.0).into_array()) as f32 * 10.0 + + self.sim.gen_ctx.hill_nz.get(wposf.div(32.0).into_array()) as f32 * 8.0 + self.sim.gen_ctx.hill_nz.get(wposf.div(256.0).into_array()) as f32 * 64.0) .rem_euclid(128.0) / 64.0 @@ -282,7 +282,7 @@ impl<'a> Sampler<'a> for ColumnGen<'a> { cliff_factor.abs().powf(1.5) } else { 0.0 - }; + } * (1.0 - near_water * 3.0).max(0.0).powi(2); let cliff_offset = cliff * cliff_height; let alt = alt + (cliff - 0.5) * cliff_height; diff --git a/world/src/layer/mod.rs b/world/src/layer/mod.rs index b5c8a603ba..6ce4c16494 100644 --- a/world/src/layer/mod.rs +++ b/world/src/layer/mod.rs @@ -110,7 +110,7 @@ pub fn apply_paths_to(canvas: &mut Canvas) { pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) { let info = canvas.info(); canvas.foreach_col(|canvas, wpos2d, col| { - let surface_z = col.riverless_alt.floor() as i32; + let surface_z = col.alt.floor() as i32; if let Some((cave_dist, _, cave, _)) = col.cave.filter(|(dist, _, cave, _)| *dist < cave.width) @@ -164,14 +164,21 @@ pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) { ) .mul(45.0) as i32; - for z in cave_roof - stalagtites..cave_roof { - canvas.set( - Vec3::new(wpos2d.x, wpos2d.y, z), - Block::new( - BlockKind::WeakRock, - info.index().colors.layer.stalagtite.into(), - ), - ); + // Generate stalagtites if there's something for them to hold on to + if canvas + .get(Vec3::new(wpos2d.x, wpos2d.y, cave_roof)) + .map(|b| b.is_filled()) + .unwrap_or(false) + { + for z in cave_roof - stalagtites..cave_roof { + canvas.set( + Vec3::new(wpos2d.x, wpos2d.y, z), + Block::new( + BlockKind::WeakRock, + info.index().colors.layer.stalagtite.into(), + ), + ); + } } let cave_depth = (col.alt - cave.alt).max(0.0); diff --git a/world/src/lib.rs b/world/src/lib.rs index 575c9ba726..67a62735ed 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -287,9 +287,9 @@ impl World { chunk: &mut chunk, }; + layer::apply_caves_to(&mut canvas, &mut dynamic_rng); layer::apply_trees_to(&mut canvas, &mut dynamic_rng); layer::apply_scatter_to(&mut canvas, &mut dynamic_rng); - layer::apply_caves_to(&mut canvas, &mut dynamic_rng); layer::apply_paths_to(&mut canvas); layer::apply_coral_to(&mut canvas);