summaryrefslogtreecommitdiff
path: root/src/mapgen/dungeongen.cpp
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2019-03-26 03:56:57 +0000
committerGitHub <noreply@github.com>2019-03-26 03:56:57 +0000
commit5e7662ca168b47ed3e81901d53bff2eb712f571c (patch)
treeff3067fc445aa13919426896f1c17905c536ffea /src/mapgen/dungeongen.cpp
parentd0a1a29ab36196a73d5454f8de368ddbf8f957e4 (diff)
downloadminetest-5e7662ca168b47ed3e81901d53bff2eb712f571c.tar.gz
minetest-5e7662ca168b47ed3e81901d53bff2eb712f571c.tar.bz2
minetest-5e7662ca168b47ed3e81901d53bff2eb712f571c.zip
Dungeons: Do not remove nodes that have 'is_ground_content = false' (#8423)
Like randomwalk caves, preserve nodes that have 'is_ground_content = false', to avoid dungeons that generate out beyond the edge of a mapchunk destroying nodes added by mods in 'register_on_generated()'. Issue discovered by, and original PR by, argyle77.
Diffstat (limited to 'src/mapgen/dungeongen.cpp')
-rw-r--r--src/mapgen/dungeongen.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mapgen/dungeongen.cpp b/src/mapgen/dungeongen.cpp
index 77ac05770..3acd22877 100644
--- a/src/mapgen/dungeongen.cpp
+++ b/src/mapgen/dungeongen.cpp
@@ -100,8 +100,11 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
if (dp.only_in_ground) {
// Set all air and liquid drawtypes to be untouchable to make dungeons
- // open to air and liquids. Optionally set ignore to be untouchable to
- // prevent projecting dungeons.
+ // open to air and liquids.
+ // Optionally set ignore to be untouchable to prevent projecting dungeons.
+ // Like randomwalk caves, preserve nodes that have 'is_ground_content = false',
+ // to avoid dungeons that generate out beyond the edge of a mapchunk destroying
+ // nodes added by mods in 'register_on_generated()'.
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);
@@ -109,7 +112,8 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
content_t c = vm->m_data[i].getContent();
NodeDrawType dtype = ndef->get(c).drawtype;
if (dtype == NDT_AIRLIKE || dtype == NDT_LIQUID ||
- (preserve_ignore && c == CONTENT_IGNORE))
+ (preserve_ignore && c == CONTENT_IGNORE) ||
+ !ndef->get(c).is_ground_content)
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
i++;
}