diff options
-rw-r--r-- | doc/lua_api.txt | 24 | ||||
-rw-r--r-- | src/mapgen/dungeongen.h | 13 | ||||
-rw-r--r-- | src/mapgen/mapgen.cpp | 119 | ||||
-rw-r--r-- | src/mapgen/mapgen.h | 10 |
4 files changed, 45 insertions, 121 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d881c4ef1..a25ada768 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -282,36 +282,26 @@ Mapgen aliases -------------- In a game, a certain number of these must be set to tell core mapgens which -of the game's nodes are to be used by the core mapgens. For example: +of the game's nodes are to be used for core mapgen generation. For example: minetest.register_alias("mapgen_stone", "default:stone") ### Aliases needed for all mapgens except Mapgen V6 -#### Base terrain - * mapgen_stone * mapgen_water_source * mapgen_river_water_source -#### Caves +`mapgen_river_water_source` is required for mapgens with sloping rivers where +it is necessary to have a river liquid node with a short `liquid_range` and +`liquid_renewable = false` to avoid flooding. -Not required if cave liquid nodes are set in biome definitions. +#### Deprecated aliases * mapgen_lava_source - -#### Dungeons - -Not required if dungeon nodes are set in biome definitions. - * mapgen_cobble -* mapgen_stair_cobble -* mapgen_mossycobble -* mapgen_desert_stone -* mapgen_stair_desert_stone -* mapgen_sandstone -* mapgen_sandstonebrick -* mapgen_stair_sandstone_block + +Use biome-defined cave liquids and dungeon nodes instead. ### Aliases needed for Mapgen V6 diff --git a/src/mapgen/dungeongen.h b/src/mapgen/dungeongen.h index 2c20446fd..7b476527b 100644 --- a/src/mapgen/dungeongen.h +++ b/src/mapgen/dungeongen.h @@ -42,22 +42,35 @@ struct DungeonParams { s32 seed; content_t c_wall; + // Randomly scattered alternative wall nodes content_t c_alt_wall; content_t c_stair; + // Diagonal corridors are possible bool diagonal_dirs; + // Dungeon only generates in ground bool only_in_ground; + // Dimensions of 3D 'brush' that creates corridors. + // Dimensions are of the empty space, not including walls / floor / ceilng. v3s16 holesize; + // Corridor length u16 corridor_len_min; u16 corridor_len_max; + // Room size includes walls / floor / ceilng v3s16 room_size_min; v3s16 room_size_max; + // The 1st room generated has a 1 in 4 chance of being 'large', all other + // rooms are not 'large'. v3s16 room_size_large_min; v3s16 room_size_large_max; + // Number of rooms u16 rooms_min; u16 rooms_max; + // Usually 'GENNOTIFY_DUNGEON', but mapgen v6 uses 'GENNOTIFY_TEMPLE' for + // desert dungeons. GenNotifyType notifytype; + // 3D noise that determines which c_wall nodes are converted to c_alt_wall NoiseParams np_alt_wall; }; diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index c4aaff00d..838253a75 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -593,45 +593,20 @@ MapgenBasic::MapgenBasic(int mapgenid, MapgenParams *params, EmergeManager *emer this->heightmap = new s16[csize.X * csize.Z]; //// Initialize biome generator - // TODO(hmmmm): should we have a way to disable biomemanager biomes? biomegen = m_bmgr->createBiomeGen(BIOMEGEN_ORIGINAL, params->bparams, csize); biomemap = biomegen->biomemap; //// Look up some commonly used content c_stone = ndef->getId("mapgen_stone"); - c_desert_stone = ndef->getId("mapgen_desert_stone"); - c_sandstone = ndef->getId("mapgen_sandstone"); c_water_source = ndef->getId("mapgen_water_source"); c_river_water_source = ndef->getId("mapgen_river_water_source"); c_lava_source = ndef->getId("mapgen_lava_source"); + c_cobble = ndef->getId("mapgen_cobble"); - // Fall back to more basic content if not defined - // river_water_source cannot fallback to water_source because river water - // needs to be non-renewable and have a short flow range. - if (c_desert_stone == CONTENT_IGNORE) - c_desert_stone = c_stone; - if (c_sandstone == CONTENT_IGNORE) - c_sandstone = c_stone; - - //// Content used for dungeon generation - c_cobble = ndef->getId("mapgen_cobble"); - c_mossycobble = ndef->getId("mapgen_mossycobble"); - c_stair_cobble = ndef->getId("mapgen_stair_cobble"); - c_stair_desert_stone = ndef->getId("mapgen_stair_desert_stone"); - c_sandstonebrick = ndef->getId("mapgen_sandstonebrick"); - c_stair_sandstone_block = ndef->getId("mapgen_stair_sandstone_block"); - - // Fall back to more basic content if not defined - if (c_mossycobble == CONTENT_IGNORE) - c_mossycobble = c_cobble; - if (c_stair_cobble == CONTENT_IGNORE) - c_stair_cobble = c_cobble; - if (c_stair_desert_stone == CONTENT_IGNORE) - c_stair_desert_stone = c_desert_stone; - if (c_sandstonebrick == CONTENT_IGNORE) - c_sandstonebrick = c_sandstone; - if (c_stair_sandstone_block == CONTENT_IGNORE) - c_stair_sandstone_block = c_sandstonebrick; + // Fall back to more basic content if not defined. + // Lava falls back to water as both are suitable as cave liquids. + if (c_lava_source == CONTENT_IGNORE) + c_lava_source = c_water_source; } @@ -911,78 +886,34 @@ void MapgenBasic::generateDungeons(s16 max_stone_y) dp.np_alt_wall = NoiseParams(-0.4, 1.0, v3f(40.0, 40.0, 40.0), 32474, 6, 1.1, 2.0); - // Biome-defined dungeon nodes + dp.diagonal_dirs = false; + dp.holesize = v3s16(2, 3, 2); + dp.room_size_min = v3s16(6, 5, 6); + dp.room_size_max = v3s16(10, 6, 10); + dp.room_size_large_min = v3s16(10, 8, 10); + dp.room_size_large_max = v3s16(18, 16, 18); + dp.notifytype = GENNOTIFY_DUNGEON; + + // Use biome-defined dungeon nodes if defined if (biome->c_dungeon != CONTENT_IGNORE) { - dp.c_wall = biome->c_dungeon; + dp.c_wall = biome->c_dungeon; // If 'node_dungeon_alt' is not defined by biome, it and dp.c_alt_wall // become CONTENT_IGNORE which skips the alt wall node placement loop in // dungeongen.cpp. - dp.c_alt_wall = biome->c_dungeon_alt; + dp.c_alt_wall = biome->c_dungeon_alt; // Stairs fall back to 'c_dungeon' if not defined by biome dp.c_stair = (biome->c_dungeon_stair != CONTENT_IGNORE) ? biome->c_dungeon_stair : biome->c_dungeon; - - dp.diagonal_dirs = false; - dp.holesize = v3s16(2, 2, 2); - dp.room_size_min = v3s16(6, 4, 6); - dp.room_size_max = v3s16(10, 6, 10); - dp.room_size_large_min = v3s16(10, 8, 10); - dp.room_size_large_max = v3s16(18, 16, 18); - dp.notifytype = GENNOTIFY_DUNGEON; - - // Otherwise classic behaviour - } else if (biome->c_stone == c_stone) { - dp.c_wall = c_cobble; - dp.c_alt_wall = c_mossycobble; - dp.c_stair = c_stair_cobble; - - dp.diagonal_dirs = false; - dp.holesize = v3s16(1, 2, 1); - dp.room_size_min = v3s16(4, 4, 4); - dp.room_size_max = v3s16(8, 6, 8); - dp.room_size_large_min = v3s16(8, 8, 8); - dp.room_size_large_max = v3s16(16, 16, 16); - dp.notifytype = GENNOTIFY_DUNGEON; - - } else if (biome->c_stone == c_desert_stone) { - dp.c_wall = c_desert_stone; - dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = c_stair_desert_stone; - - dp.diagonal_dirs = true; - dp.holesize = v3s16(2, 3, 2); - dp.room_size_min = v3s16(6, 9, 6); - dp.room_size_max = v3s16(10, 11, 10); - dp.room_size_large_min = v3s16(10, 13, 10); - dp.room_size_large_max = v3s16(18, 21, 18); - dp.notifytype = GENNOTIFY_TEMPLE; - - } else if (biome->c_stone == c_sandstone) { - dp.c_wall = c_sandstonebrick; - dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = c_stair_sandstone_block; - - dp.diagonal_dirs = false; - dp.holesize = v3s16(2, 2, 2); - dp.room_size_min = v3s16(6, 4, 6); - dp.room_size_max = v3s16(10, 6, 10); - dp.room_size_large_min = v3s16(10, 8, 10); - dp.room_size_large_max = v3s16(18, 16, 18); - dp.notifytype = GENNOTIFY_DUNGEON; - - // Fallback to using biome 'node_stone' + // Fallback to using cobble mapgen alias if defined + } else if (c_cobble != CONTENT_IGNORE) { + dp.c_wall = c_cobble; + dp.c_alt_wall = CONTENT_IGNORE; + dp.c_stair = c_cobble; + // Fallback to using biome-defined stone } else { - dp.c_wall = biome->c_stone; - dp.c_alt_wall = CONTENT_IGNORE; - dp.c_stair = biome->c_stone; - - dp.diagonal_dirs = false; - dp.holesize = v3s16(2, 2, 2); - dp.room_size_min = v3s16(6, 4, 6); - dp.room_size_max = v3s16(10, 6, 10); - dp.room_size_large_min = v3s16(10, 8, 10); - dp.room_size_large_max = v3s16(18, 16, 18); - dp.notifytype = GENNOTIFY_DUNGEON; + dp.c_wall = biome->c_stone; + dp.c_alt_wall = CONTENT_IGNORE; + dp.c_stair = biome->c_stone; } DungeonGen dgen(ndef, &gennotify, &dp); diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h index 2fc3aed95..f98c3f377 100644 --- a/src/mapgen/mapgen.h +++ b/src/mapgen/mapgen.h @@ -257,21 +257,11 @@ protected: v3s16 full_node_min; v3s16 full_node_max; - // Content required for generateBiomes content_t c_stone; - content_t c_desert_stone; - content_t c_sandstone; content_t c_water_source; content_t c_river_water_source; content_t c_lava_source; - - // Content required for generateDungeons content_t c_cobble; - content_t c_stair_cobble; - content_t c_mossycobble; - content_t c_stair_desert_stone; - content_t c_sandstonebrick; - content_t c_stair_sandstone_block; int ystride; int zstride; |