Skip to content

Commit ffdf8de

Browse files
committedMar 7, 2015
Dungeongen: Optionally set ignore to be untouchable to disable floating dungeons
1 parent e9eda2b commit ffdf8de

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
 

Diff for: ‎minetest.conf.example

+2
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@
469469
# Controls size of deserts and beaches in Mapgen V6
470470
#mgv6_freq_desert = 0.45
471471
#mgv6_freq_beach = 0.15
472+
# Enable/disable floating dungeons and dungeon slices
473+
#enable_floating_dungeons = true
472474

473475
# Perlin noise attributes for different map generation parameters.
474476
# Noise parameters can be specified as a set of positional values:

Diff for: ‎src/defaultsettings.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ void set_default_settings(Settings *settings)
292292
settings->setDefault("water_level", "1");
293293
settings->setDefault("chunksize", "5");
294294
settings->setDefault("mg_flags", "");
295+
settings->setDefault("enable_floating_dungeons", "true");
295296

296297
// IPv6
297298
settings->setDefault("enable_ipv6", "true");

Diff for: ‎src/dungeongen.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ void DungeonGen::generate(u32 bseed, v3s16 nmin, v3s16 nmax) {
7979
// Dungeon generator doesn't modify places which have this set
8080
vm->clearFlag(VMANIP_FLAG_DUNGEON_INSIDE | VMANIP_FLAG_DUNGEON_PRESERVE);
8181

82-
// Set all air and water to be untouchable to make dungeons open
83-
// to caves and open air
82+
bool no_float = !g_settings->getBool("enable_floating_dungeons");
83+
84+
// Set all air and water (and optionally ignore) to be untouchable
85+
// to make dungeons open to caves and open air
8486
for (s16 z = nmin.Z; z <= nmax.Z; z++) {
8587
for (s16 y = nmin.Y; y <= nmax.Y; y++) {
8688
u32 i = vm->m_area.index(nmin.X, y, z);
8789
for (s16 x = nmin.X; x <= nmax.X; x++) {
8890
content_t c = vm->m_data[i].getContent();
89-
if (c == CONTENT_AIR || c == dp.c_water)
91+
if (c == CONTENT_AIR || c == dp.c_water
92+
|| (no_float && c == CONTENT_IGNORE))
9093
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
9194
i++;
9295
}

1 commit comments

Comments
 (1)

HybridDog commented on Mar 7, 2015

@HybridDog
Contributor

desdung
Can l somehow reduce the amount of desert dungeons?

Please sign in to comment.