Skip to content

Commit ab746b0

Browse files
committedJul 2, 2017
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.
1 parent c358004 commit ab746b0

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed
 

Diff for: ‎builtin/settingtypes.txt

+3
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,9 @@ mapgen_limit (Map generation limit) int 31000 0 31000
984984
# Flags starting with 'no' are used to explicitly disable them.
985985
mg_flags (Mapgen flags) flags caves,dungeons,light,decorations caves,dungeons,light,decorations,nocaves,nodungeons,nolight,nodecorations
986986

987+
# Whether dungeons occasionally project from the terrain.
988+
projecting_dungeons (Projecting dungeons) bool true
989+
987990
[**Advanced]
988991

989992
# Size of chunks to be generated at once by mapgen, stated in mapblocks (16 nodes).

Diff for: ‎minetest.conf.example

+4
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,10 @@
12011201
# type: flags possible values: caves, dungeons, light, decorations, nocaves, nodungeons, nolight, nodecorations
12021202
# mg_flags = caves,dungeons,light,decorations
12031203

1204+
# Whether dungeons occasionally project from the terrain.
1205+
# type: bool
1206+
# projecting_dungeons = true
1207+
12041208
### Advanced
12051209

12061210
# Size of chunks to be generated at once by mapgen, stated in mapblocks (16 nodes).

Diff for: ‎src/defaultsettings.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ void set_default_settings(Settings *settings)
349349
settings->setDefault("mg_flags", "dungeons");
350350
settings->setDefault("fixed_map_seed", "");
351351
settings->setDefault("max_block_generate_distance", "7");
352+
settings->setDefault("projecting_dungeons", "true");
352353
settings->setDefault("enable_mapgen_debug_info", "false");
353354

354355
// Server list announcing

Diff for: ‎src/dungeongen.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
9797
if (nval_density < 1.0f)
9898
return;
9999

100+
static const bool preserve_ignore = !g_settings->getBool("projecting_dungeons");
101+
100102
this->vm = vm;
101103
this->blockseed = bseed;
102104
random.seed(bseed + 2);
@@ -105,14 +107,16 @@ void DungeonGen::generate(MMVManip *vm, u32 bseed, v3s16 nmin, v3s16 nmax)
105107
vm->clearFlag(VMANIP_FLAG_DUNGEON_INSIDE | VMANIP_FLAG_DUNGEON_PRESERVE);
106108

107109
if (dp.only_in_ground) {
108-
// Set all air and water to be untouchable
109-
// to make dungeons open to caves and open air
110+
// Set all air and water to be untouchable to make dungeons open to
111+
// caves and open air. Optionally set ignore to be untouchable to
112+
// prevent protruding dungeons.
110113
for (s16 z = nmin.Z; z <= nmax.Z; z++) {
111114
for (s16 y = nmin.Y; y <= nmax.Y; y++) {
112115
u32 i = vm->m_area.index(nmin.X, y, z);
113116
for (s16 x = nmin.X; x <= nmax.X; x++) {
114117
content_t c = vm->m_data[i].getContent();
115118
if (c == CONTENT_AIR || c == dp.c_water ||
119+
(preserve_ignore && c == CONTENT_IGNORE) ||
116120
c == dp.c_river_water)
117121
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
118122
i++;

0 commit comments

Comments
 (0)
Please sign in to comment.