From 34e66829dfd51fe7fd7d0129b3d1ff020f82ced7 Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Tue, 1 Jun 2021 22:43:50 +0200 Subject: [PATCH] Extract 'new_method3' from 'apply_paths_to' --- world/src/layer/mod.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/world/src/layer/mod.rs b/world/src/layer/mod.rs index 1effed3c72..f5df785867 100644 --- a/world/src/layer/mod.rs +++ b/world/src/layer/mod.rs @@ -6,6 +6,7 @@ pub use self::{scatter::apply_scatter_to, tree::apply_trees_to}; use crate::{ column::ColumnSample, + sim::Path, util::{FastNoise, RandomField, Sampler}, Canvas, CanvasInfo, IndexRef, }; @@ -58,13 +59,7 @@ pub fn apply_paths_to(canvas: &mut Canvas) { }, ); } - let head_space = path.head_space(path_dist); - for z in 0..head_space { - let pos = Vec3::new(wpos2d.x, wpos2d.y, surface_z + z); - if canvas.get(pos).kind() != BlockKind::Water { - let _ = canvas.set(pos, EMPTY_AIR); - } - } + new_method3(canvas, wpos2d, path_dist, path, surface_z) } }); } @@ -119,6 +114,17 @@ fn new_method2(block_kind: BlockKind, color: Rgb) -> Block { Block::new(block_kind, noisy_color(color, 8)) } +//TODO: Rename +fn new_method3(canvas: &mut Canvas, wpos2d: Vec2, path_dist: f32, path: Path, surface_z: i32) { + let head_space = path.head_space(path_dist); + for z in 0..head_space { + let pos = Vec3::new(wpos2d.x, wpos2d.y, surface_z + z); + if canvas.get(pos).kind() != BlockKind::Water { + let _ = canvas.set(pos, EMPTY_AIR); + } + } +} + pub fn apply_caves_to(canvas: &mut Canvas, rng: &mut impl Rng) { let info = canvas.info(); canvas.foreach_col(|canvas, wpos2d, col| {