]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Dungeons: Add setting to prevent projecting dungeons
authorparamat <paramat@users.noreply.github.com>
Mon, 26 Jun 2017 05:24:30 +0000 (06:24 +0100)
committerparamat <mat.gregory@virginmedia.com>
Sun, 2 Jul 2017 12:33:21 +0000 (13:33 +0100)
Prevents dungeons generating into ignore nodes in ungenerated mapchunks,
which can occasionally result in a dungeon projecting from the terrain.

builtin/settingtypes.txt
minetest.conf.example
src/defaultsettings.cpp
src/dungeongen.cpp

index 192ce5b66fd3a0fb67bf8ed176e296227ca02887..10e3969e7ee25c3f844dffe8d85217cd33291f16 100644 (file)
@@ -984,6 +984,9 @@ mapgen_limit (Map generation limit) int 31000 0 31000
 #    Flags starting with 'no' are used to explicitly disable them.
 mg_flags (Mapgen flags) flags caves,dungeons,light,decorations caves,dungeons,light,decorations,nocaves,nodungeons,nolight,nodecorations
 
+#    Whether dungeons occasionally project from the terrain.
+projecting_dungeons (Projecting dungeons) bool true
+
 [**Advanced]
 
 #    Size of chunks to be generated at once by mapgen, stated in mapblocks (16 nodes).
index f5f3f5e8c4748d723a21056630b22cba4d3572da..77cc3ed53c5840ba28162a7e5a92890d29090636 100644 (file)
 #    type: flags possible values: caves, dungeons, light, decorations, nocaves, nodungeons, nolight, nodecorations
 # mg_flags = caves,dungeons,light,decorations
 
+#    Whether dungeons occasionally project from the terrain.
+#    type: bool
+# projecting_dungeons = true
+
 ### Advanced
 
 #    Size of chunks to be generated at once by mapgen, stated in mapblocks (16 nodes).
index 42e369f6051ba57e79a15352087570a405391663..fe3a4d27547b6408b3c6f9a3a9936e14c2c8af71 100644 (file)
@@ -349,6 +349,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("mg_flags", "dungeons");
        settings->setDefault("fixed_map_seed", "");
        settings->setDefault("max_block_generate_distance", "7");
+       settings->setDefault("projecting_dungeons", "true");
        settings->setDefault("enable_mapgen_debug_info", "false");
 
        // Server list announcing
index 6cef3f88dbd432c273ea2699db227ade13071ca4..883492babf2632fc674ac793c93d92ea5243fcfb 100644 (file)
@@ -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++;