Dungeongen: Optionally set ignore to be untouchable to disable floating dungeons

master
paramat 2015-03-06 04:46:05 +00:00
parent e9eda2b0d0
commit ffdf8dedb7
3 changed files with 9 additions and 3 deletions

View File

@ -469,6 +469,8 @@
# Controls size of deserts and beaches in Mapgen V6 # Controls size of deserts and beaches in Mapgen V6
#mgv6_freq_desert = 0.45 #mgv6_freq_desert = 0.45
#mgv6_freq_beach = 0.15 #mgv6_freq_beach = 0.15
# Enable/disable floating dungeons and dungeon slices
#enable_floating_dungeons = true
# Perlin noise attributes for different map generation parameters. # Perlin noise attributes for different map generation parameters.
# Noise parameters can be specified as a set of positional values: # Noise parameters can be specified as a set of positional values:

View File

@ -292,6 +292,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("water_level", "1"); settings->setDefault("water_level", "1");
settings->setDefault("chunksize", "5"); settings->setDefault("chunksize", "5");
settings->setDefault("mg_flags", ""); settings->setDefault("mg_flags", "");
settings->setDefault("enable_floating_dungeons", "true");
// IPv6 // IPv6
settings->setDefault("enable_ipv6", "true"); settings->setDefault("enable_ipv6", "true");

View File

@ -79,14 +79,17 @@ void DungeonGen::generate(u32 bseed, v3s16 nmin, v3s16 nmax) {
// Dungeon generator doesn't modify places which have this set // Dungeon generator doesn't modify places which have this set
vm->clearFlag(VMANIP_FLAG_DUNGEON_INSIDE | VMANIP_FLAG_DUNGEON_PRESERVE); vm->clearFlag(VMANIP_FLAG_DUNGEON_INSIDE | VMANIP_FLAG_DUNGEON_PRESERVE);
// Set all air and water to be untouchable to make dungeons open bool no_float = !g_settings->getBool("enable_floating_dungeons");
// to caves and open air
// Set all air and water (and optionally ignore) to be untouchable
// to make dungeons open to caves and open air
for (s16 z = nmin.Z; z <= nmax.Z; z++) { for (s16 z = nmin.Z; z <= nmax.Z; z++) {
for (s16 y = nmin.Y; y <= nmax.Y; y++) { for (s16 y = nmin.Y; y <= nmax.Y; y++) {
u32 i = vm->m_area.index(nmin.X, y, z); u32 i = vm->m_area.index(nmin.X, y, z);
for (s16 x = nmin.X; x <= nmax.X; x++) { for (s16 x = nmin.X; x <= nmax.X; x++) {
content_t c = vm->m_data[i].getContent(); content_t c = vm->m_data[i].getContent();
if (c == CONTENT_AIR || c == dp.c_water) if (c == CONTENT_AIR || c == dp.c_water
|| (no_float && c == CONTENT_IGNORE))
vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE; vm->m_flags[i] |= VMANIP_FLAG_DUNGEON_PRESERVE;
i++; i++;
} }