diff --git a/world/src/layer/mod.rs b/world/src/layer/mod.rs index 22c023023f..33a5ca2d9e 100644 --- a/world/src/layer/mod.rs +++ b/world/src/layer/mod.rs @@ -107,7 +107,7 @@ pub fn apply_paths_to(canvas: &mut Canvas) { }); } -pub fn apply_caves_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; @@ -178,13 +178,11 @@ pub fn apply_caves_to(canvas: &mut Canvas) { let difficulty = cave_depth / 100.0; // Scatter things in caves - if RandomField::new(info.index().seed) - .chance(wpos2d.into(), 0.001 * difficulty.powf(1.5)) - && cave_base < surface_z as i32 - 25 + if rng.gen::() < 0.001 * difficulty.powf(1.5) && cave_base < surface_z as i32 - 25 { - let lottery = Lottery::::load_expect("common.cave_scatter").read(); - let kind = *lottery - .choose_seeded(RandomField::new(info.index().seed + 1).get(wpos2d.into())); + let kind = *Lottery::::load_expect("common.cave_scatter") + .read() + .choose(); canvas.map(Vec3::new(wpos2d.x, wpos2d.y, cave_base), |block| { block.with_sprite(kind) }); diff --git a/world/src/lib.rs b/world/src/lib.rs index 770be7c1d5..b1e1ba9431 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -286,7 +286,7 @@ impl World { layer::apply_trees_to(&mut canvas); layer::apply_scatter_to(&mut canvas, &mut dynamic_rng); - layer::apply_caves_to(&mut canvas); + layer::apply_caves_to(&mut canvas, &mut dynamic_rng); layer::apply_paths_to(&mut canvas); // Apply site generation