diff --git a/gui-src/css/styles.css b/gui-src/css/styles.css
index e89636bc..73c7ed8f 100644
--- a/gui-src/css/styles.css
+++ b/gui-src/css/styles.css
@@ -251,6 +251,14 @@ button:hover {
margin: 15px 0;
}
+#fillground-toggle {
+ accent-color: #fecc44;
+}
+
+.fillground-toggle-container, .scale-slider-container {
+ margin: 15px 0;
+}
+
#winter-toggle {
accent-color: #fecc44;
}
diff --git a/gui-src/index.html b/gui-src/index.html
index fb560ef6..1922913d 100644
--- a/gui-src/index.html
+++ b/gui-src/index.html
@@ -91,7 +91,11 @@
diff --git a/gui-src/js/main.js b/gui-src/js/main.js
index 168de5cd..3707057e 100644
--- a/gui-src/js/main.js
+++ b/gui-src/js/main.js
@@ -480,6 +480,7 @@ async function startGeneration() {
var terrain = document.getElementById("terrain-toggle").checked;
var winter_mode = document.getElementById("winter-toggle").checked;
+ var fill_ground = document.getElementById("fillground-toggle").checked;
var scale = parseFloat(document.getElementById("scale-value-slider").value);
var floodfill_timeout = parseInt(document.getElementById("floodfill-timeout").value, 10);
var ground_level = parseInt(document.getElementById("ground-level").value, 10);
@@ -496,7 +497,8 @@ async function startGeneration() {
groundLevel: ground_level,
winterMode: winter_mode,
floodfillTimeout: floodfill_timeout,
- terrainEnabled: terrain
+ terrainEnabled: terrain,
+ fillgroundEnabled: fill_ground
});
console.log("Generation process started.");
diff --git a/src/args.rs b/src/args.rs
index 046c32d3..59795a03 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -44,7 +44,9 @@ pub struct Args {
/// Enable terrain (optional)
#[arg(long, default_value_t = false, action = clap::ArgAction::SetFalse)]
pub terrain: bool,
-
+ /// Enable filling ground (optional)
+ #[arg(long, default_value_t = false, action = clap::ArgAction::SetFalse)]
+ pub fillground: bool,
/// Enable debug mode (optional)
#[arg(long, default_value_t = false, action = clap::ArgAction::SetTrue)]
pub debug: bool,
diff --git a/src/data_processing.rs b/src/data_processing.rs
index 1b9e49dd..7cb391a6 100644
--- a/src/data_processing.rs
+++ b/src/data_processing.rs
@@ -1,5 +1,5 @@
use crate::args::Args;
-use crate::block_definitions::{DIRT, GRASS_BLOCK, SNOW_BLOCK};
+use crate::block_definitions::{BEDROCK, DIRT, GRASS_BLOCK, SNOW_BLOCK, STONE};
use crate::cartesian::XZPoint;
use crate::element_processing::*;
use crate::ground::Ground;
@@ -9,7 +9,7 @@ use crate::world_editor::WorldEditor;
use colored::Colorize;
use indicatif::{ProgressBar, ProgressStyle};
-const MIN_Y: i32 = -64;
+pub const MIN_Y: i32 = -64;
pub fn generate_world(
elements: Vec
,
@@ -170,6 +170,13 @@ pub fn generate_world(
editor.set_block(groundlayer_block, x, max_y, z, None, None);
editor.set_block(DIRT, x, max_y - 1, z, None, None);
editor.set_block(DIRT, x, max_y - 2, z, None, None);
+ // Fill underground with stone
+ if args.fillground {
+ for y in MIN_Y + 1..max_y - 2 {
+ editor.set_block(STONE, x, y, z, None, None);
+ }
+ }
+ editor.set_block(BEDROCK, x, MIN_Y, z, None, Some(&[BEDROCK]));
block_counter += 1;
if block_counter % batch_size == 0 {
@@ -196,6 +203,7 @@ pub fn generate_world(
let ground_level = ground.level(XZPoint::new(x, z));
editor.set_block(groundlayer_block, x, ground_level, z, None, None);
editor.set_block(DIRT, x, ground_level - 1, z, None, None);
+ editor.set_block(BEDROCK, x, MIN_Y, z, None, Some(&[BEDROCK]));
block_counter += 1;
if block_counter % batch_size == 0 {
diff --git a/src/element_processing/landuse.rs b/src/element_processing/landuse.rs
index e2f1fafc..2a34c46a 100644
--- a/src/element_processing/landuse.rs
+++ b/src/element_processing/landuse.rs
@@ -1,6 +1,7 @@
use crate::args::Args;
use crate::block_definitions::*;
use crate::cartesian::XZPoint;
+use crate::data_processing::MIN_Y;
use crate::element_processing::tree::create_tree;
use crate::floodfill::flood_fill_area;
use crate::ground::Ground;
@@ -363,6 +364,12 @@ pub fn generate_landuse(
if random_choice < 5 {
editor.set_block(ore_block, x, ground_level, z, Some(&[STONE]), None);
}
+ // Fill everything with stone so dirt won't be there
+ if args.fillground {
+ for y in MIN_Y + 1..ground_level {
+ editor.set_block(STONE, x, y, z, None, None);
+ }
+ }
}
}
_ => {}
diff --git a/src/main.rs b/src/main.rs
index 7c27de2b..6d673fbb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -400,6 +400,7 @@ fn gui_start_generation(
winter_mode: bool,
floodfill_timeout: u64,
terrain_enabled: bool,
+ fillground_enabled: bool,
) -> Result<(), String> {
tauri::async_runtime::spawn(async move {
if let Err(e) = tokio::task::spawn_blocking(move || {
@@ -427,6 +428,7 @@ fn gui_start_generation(
scale: world_scale,
ground_level,
terrain: terrain_enabled,
+ fillground: fillground_enabled,
winter: winter_mode,
debug: false,
timeout: Some(std::time::Duration::from_secs(floodfill_timeout)),