mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Biome API: Add shore top and shore filler nodes, underwater node, water top node. Add water top depth and shore height parameters. Remove water dust node
This commit is contained in:
parent
61dfa912f5
commit
570c2042b1
5 changed files with 91 additions and 62 deletions
|
@ -417,10 +417,12 @@ void MapgenV5::generateBiomes() {
|
|||
|
||||
for (s16 z = node_min.Z; z <= node_max.Z; z++)
|
||||
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
|
||||
Biome *biome = (Biome *)bmgr->get(biomemap[index]);
|
||||
s16 dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
||||
s16 y0_top = biome->depth_top;
|
||||
s16 y0_filler = biome->depth_top + dfiller;
|
||||
Biome *biome = (Biome *)bmgr->get(biomemap[index]);
|
||||
s16 dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
||||
s16 y0_top = biome->depth_top;
|
||||
s16 y0_filler = biome->depth_top + dfiller;
|
||||
s16 shore_max = water_level + biome->height_shore;
|
||||
s16 depth_water_top = biome->depth_water_top;
|
||||
|
||||
s16 nplaced = 0;
|
||||
u32 i = vm->m_area.index(x, node_max.Y, z);
|
||||
|
@ -439,15 +441,20 @@ void MapgenV5::generateBiomes() {
|
|||
|
||||
if (c_below != CONTENT_AIR) {
|
||||
if (nplaced < y0_top) {
|
||||
// A hack to prevent dirt_with_grass from being
|
||||
// placed below water. TODO: fix later
|
||||
content_t c_place = ((y < water_level) &&
|
||||
(biome->c_top == c_dirt_with_grass)) ?
|
||||
c_dirt : biome->c_top;
|
||||
vm->m_data[i] = MapNode(c_place);
|
||||
if(y < water_level)
|
||||
vm->m_data[i] = MapNode(biome->c_underwater);
|
||||
else if(y <= shore_max)
|
||||
vm->m_data[i] = MapNode(biome->c_shore_top);
|
||||
else
|
||||
vm->m_data[i] = MapNode(biome->c_top);
|
||||
nplaced++;
|
||||
} else if (nplaced < y0_filler && nplaced >= y0_top) {
|
||||
vm->m_data[i] = MapNode(biome->c_filler);
|
||||
if(y < water_level)
|
||||
vm->m_data[i] = MapNode(biome->c_underwater);
|
||||
else if(y <= shore_max)
|
||||
vm->m_data[i] = MapNode(biome->c_shore_filler);
|
||||
else
|
||||
vm->m_data[i] = MapNode(biome->c_filler);
|
||||
nplaced++;
|
||||
} else if (c == c_stone) {
|
||||
have_air = false;
|
||||
|
@ -469,7 +476,10 @@ void MapgenV5::generateBiomes() {
|
|||
} else if (c == c_water_source) {
|
||||
have_air = true;
|
||||
nplaced = 0;
|
||||
vm->m_data[i] = MapNode(biome->c_water);
|
||||
if(y > water_level - depth_water_top)
|
||||
vm->m_data[i] = MapNode(biome->c_water_top);
|
||||
else
|
||||
vm->m_data[i] = MapNode(biome->c_water);
|
||||
} else if (c == CONTENT_AIR) {
|
||||
have_air = true;
|
||||
nplaced = 0;
|
||||
|
@ -480,6 +490,7 @@ void MapgenV5::generateBiomes() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void MapgenV5::dustTopNodes() {
|
||||
v3s16 em = vm->m_area.getExtent();
|
||||
u32 index = 0;
|
||||
|
@ -504,12 +515,7 @@ void MapgenV5::dustTopNodes() {
|
|||
}
|
||||
|
||||
content_t c = vm->m_data[vi].getContent();
|
||||
if (c == biome->c_water && biome->c_dust_water != CONTENT_IGNORE) {
|
||||
if (y < node_min.Y - 1)
|
||||
continue;
|
||||
|
||||
vm->m_data[vi] = MapNode(biome->c_dust_water);
|
||||
} else if (!ndef->get(c).buildable_to && c != CONTENT_IGNORE
|
||||
if (!ndef->get(c).buildable_to && c != CONTENT_IGNORE
|
||||
&& c != biome->c_dust) {
|
||||
if (y == node_max.Y + 1)
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue