aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen/mapgen_v7.cpp
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2019-06-01 20:50:43 +0100
committerGitHub <noreply@github.com>2019-06-01 20:50:43 +0100
commit7379aa74cf98c7e4c7aa5325ef1531d412a0abac (patch)
tree45a3c608dce1fd03182f4f84f1968439dbfa4dbc /src/mapgen/mapgen_v7.cpp
parenta1459a9eac4eeb35a6c578a8b8f96393f87ed53d (diff)
downloadminetest-7379aa74cf98c7e4c7aa5325ef1531d412a0abac.tar.gz
minetest-7379aa74cf98c7e4c7aa5325ef1531d412a0abac.tar.bz2
minetest-7379aa74cf98c7e4c7aa5325ef1531d412a0abac.zip
Dungeons: Settable density noise, move number calculation to mapgens (#8473)
Add user-settable noise parameters for dungeon density to each mapgen, except V6 which hardcodes this noise parameter. Move the calculation of number of dungeons generated in a mapchunk out of dungeongen.cpp and into mapgen code, to allow mapgens to generate any desired number of dungeons in a mapchunk, instead of being forced to have number of dungeons determined by a density noise. This is more flexible and allows mapgens to use dungeon generation to create custom structures, such as occasional mega-dungeons.
Diffstat (limited to 'src/mapgen/mapgen_v7.cpp')
-rw-r--r--src/mapgen/mapgen_v7.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mapgen/mapgen_v7.cpp b/src/mapgen/mapgen_v7.cpp
index ad5220925..c9568760f 100644
--- a/src/mapgen/mapgen_v7.cpp
+++ b/src/mapgen/mapgen_v7.cpp
@@ -113,9 +113,10 @@ MapgenV7::MapgenV7(MapgenV7Params *params, EmergeManager *emerge)
new Noise(&params->np_mountain, seed, csize.X, csize.Y + 2, csize.Z);
// 3D noise, 1 down overgeneration
- MapgenBasic::np_cave1 = params->np_cave1;
- MapgenBasic::np_cave2 = params->np_cave2;
- MapgenBasic::np_cavern = params->np_cavern;
+ MapgenBasic::np_cave1 = params->np_cave1;
+ MapgenBasic::np_cave2 = params->np_cave2;
+ MapgenBasic::np_cavern = params->np_cavern;
+ MapgenBasic::np_dungeons = params->np_dungeons;
}
@@ -159,7 +160,8 @@ MapgenV7Params::MapgenV7Params():
np_ridge (0.0, 1.0, v3f(100, 100, 100), 6467, 4, 0.75, 2.0),
np_cavern (0.0, 1.0, v3f(384, 128, 384), 723, 5, 0.63, 2.0),
np_cave1 (0.0, 12.0, v3f(61, 61, 61), 52534, 3, 0.5, 2.0),
- np_cave2 (0.0, 12.0, v3f(67, 67, 67), 10325, 3, 0.5, 2.0)
+ np_cave2 (0.0, 12.0, v3f(67, 67, 67), 10325, 3, 0.5, 2.0),
+ np_dungeons (0.9, 0.5, v3f(500, 500, 500), 0, 2, 0.8, 2.0)
{
}
@@ -196,6 +198,7 @@ void MapgenV7Params::readParams(const Settings *settings)
settings->getNoiseParams("mgv7_np_cavern", np_cavern);
settings->getNoiseParams("mgv7_np_cave1", np_cave1);
settings->getNoiseParams("mgv7_np_cave2", np_cave2);
+ settings->getNoiseParams("mgv7_np_dungeons", np_dungeons);
}
@@ -231,6 +234,7 @@ void MapgenV7Params::writeParams(Settings *settings) const
settings->setNoiseParams("mgv7_np_cavern", np_cavern);
settings->setNoiseParams("mgv7_np_cave1", np_cave1);
settings->setNoiseParams("mgv7_np_cave2", np_cave2);
+ settings->setNoiseParams("mgv7_np_dungeons", np_dungeons);
}