aboutsummaryrefslogtreecommitdiff
path: root/src/dungeongen.cpp
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-06-26 06:24:30 +0100
committerparamat <mat.gregory@virginmedia.com>2017-07-02 13:33:21 +0100
commitab746b0704a0b013d131f3da8e06f56ebd2a0417 (patch)
tree66bb66f00b9cc5081755530e37ea89778d0d1b01 /src/dungeongen.cpp
parentc3580043685671c4f767e1c380ae7c3e237f8b8b (diff)
downloadminetest-ab746b0704a0b013d131f3da8e06f56ebd2a0417.tar.gz
minetest-ab746b0704a0b013d131f3da8e06f56ebd2a0417.tar.bz2
minetest-ab746b0704a0b013d131f3da8e06f56ebd2a0417.zip
Dungeons: Add setting to prevent projecting dungeons
Prevents dungeons generating into ignore nodes in ungenerated mapchunks, which can occasionally result in a dungeon projecting from the terrain.
Diffstat (limited to 'src/dungeongen.cpp')
-rw-r--r--src/dungeongen.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp
index 6cef3f88d..883492bab 100644
--- a/src/dungeongen.cpp
+++ b/src/dungeongen.cpp
@@ -97,6 +97,8 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
if (nval_density < 1.0f)
return;
+ static const bool preserve_ignore = !g_settings->getBool("projecting_dungeons");
+
this->vm = vm;
this->blockseed = bseed;
random.seed(bseed + 2);
@@ -105,14 +107,16 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
vm->clearFlag(VMANIP_FLAG_DUNGEON_INSIDE | VMANIP_FLAG_DUNGEON_PRESERVE);
if (dp.only_in_ground) {
- // Set all air and water to be untouchable
- // to make dungeons open to caves and open air
+ // Set all air and water to be untouchable to make dungeons open to
+ // caves and open air. Optionally set ignore to be untouchable to
+ // prevent protruding dungeons.
for (s16 z = nmin.Z; z <= nmax.Z; z++) {
for (s16 y = nmin.Y; y <= nmax.Y; y++) {
u32 i = vm->m_area.index(nmin.X, y, z);
for (s16 x = nmin.X; x <= nmax.X; x++) {
content_t c = vm->m_data[i].getContent();
if (c == CONTENT_AIR || c == dp.c_water ||
+ (preserve_ignore && c == CONTENT_IGNORE) ||
c == dp.c_river_water)
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
i++;