forked from Mirrorlandia_minetest/minetest
Add definable node_stone to biome API, mgv5, mgv7. Reduce and correct depth of mgv7 biomes. l_mapgen.cpp: add '#include mapgen_v5.h' because '#include mapgen_v7' is there. Improve underwater grass hack
This commit is contained in:
parent
fcb1ea903f
commit
0a5373d400
@ -451,23 +451,31 @@ void MapgenV5::generateBiomes() {
|
|||||||
|
|
||||||
if (c_below != CONTENT_AIR) {
|
if (c_below != CONTENT_AIR) {
|
||||||
if (nplaced < y0_top) {
|
if (nplaced < y0_top) {
|
||||||
// A hack to prevent dirt_with_grass from being
|
if(y < water_level)
|
||||||
// placed below water. TODO: fix later
|
vm->m_data[i] = MapNode(biome->c_filler);
|
||||||
content_t c_place = ((y < water_level) &&
|
else
|
||||||
(biome->c_top ==
|
vm->m_data[i] = MapNode(biome->c_top);
|
||||||
c_dirt_with_grass)) ?
|
|
||||||
c_dirt : biome->c_top;
|
|
||||||
|
|
||||||
vm->m_data[i] = MapNode(c_place);
|
|
||||||
nplaced++;
|
nplaced++;
|
||||||
} else if (nplaced < y0_filler && nplaced >= y0_top) {
|
} else if (nplaced < y0_filler && nplaced >= y0_top) {
|
||||||
vm->m_data[i] = MapNode(biome->c_filler);
|
vm->m_data[i] = MapNode(biome->c_filler);
|
||||||
nplaced++;
|
nplaced++;
|
||||||
|
} else if (c == c_stone) {
|
||||||
|
have_air = false;
|
||||||
|
nplaced = 0;
|
||||||
|
vm->m_data[i] = MapNode(biome->c_stone);
|
||||||
} else {
|
} else {
|
||||||
have_air = false;
|
have_air = false;
|
||||||
nplaced = 0;
|
nplaced = 0;
|
||||||
}
|
}
|
||||||
|
} else if (c == c_stone) {
|
||||||
|
have_air = false;
|
||||||
|
nplaced = 0;
|
||||||
|
vm->m_data[i] = MapNode(biome->c_stone);
|
||||||
}
|
}
|
||||||
|
} else if (c == c_stone) {
|
||||||
|
have_air = false;
|
||||||
|
nplaced = 0;
|
||||||
|
vm->m_data[i] = MapNode(biome->c_stone);
|
||||||
} else if (c == c_water_source) {
|
} else if (c == c_water_source) {
|
||||||
have_air = true;
|
have_air = true;
|
||||||
nplaced = 0;
|
nplaced = 0;
|
||||||
|
@ -534,7 +534,7 @@ void MapgenV7::generateBiomes() {
|
|||||||
Biome *biome = (Biome *)bmgr->get(biomemap[index]);
|
Biome *biome = (Biome *)bmgr->get(biomemap[index]);
|
||||||
s16 dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
s16 dfiller = biome->depth_filler + noise_filler_depth->result[index];
|
||||||
s16 y0_top = biome->depth_top;
|
s16 y0_top = biome->depth_top;
|
||||||
s16 y0_filler = biome->depth_filler + biome->depth_top + dfiller;
|
s16 y0_filler = biome->depth_top + dfiller;
|
||||||
|
|
||||||
s16 nplaced = 0;
|
s16 nplaced = 0;
|
||||||
u32 i = vm->m_area.index(x, node_max.Y, z);
|
u32 i = vm->m_area.index(x, node_max.Y, z);
|
||||||
@ -560,22 +560,31 @@ void MapgenV7::generateBiomes() {
|
|||||||
|
|
||||||
if (c_below != CONTENT_AIR) {
|
if (c_below != CONTENT_AIR) {
|
||||||
if (nplaced < y0_top) {
|
if (nplaced < y0_top) {
|
||||||
// A hack to prevent dirt_with_grass from being
|
if(y < water_level)
|
||||||
// placed below water. TODO: fix later
|
vm->m_data[i] = MapNode(biome->c_filler);
|
||||||
content_t c_place = ((y < water_level) &&
|
else
|
||||||
(biome->c_top == c_dirt_with_grass)) ?
|
vm->m_data[i] = MapNode(biome->c_top);
|
||||||
c_dirt : biome->c_top;
|
|
||||||
|
|
||||||
vm->m_data[i] = MapNode(c_place);
|
|
||||||
nplaced++;
|
nplaced++;
|
||||||
} else if (nplaced < y0_filler && nplaced >= y0_top) {
|
} else if (nplaced < y0_filler && nplaced >= y0_top) {
|
||||||
vm->m_data[i] = MapNode(biome->c_filler);
|
vm->m_data[i] = MapNode(biome->c_filler);
|
||||||
nplaced++;
|
nplaced++;
|
||||||
|
} else if (c == c_stone) {
|
||||||
|
have_air = false;
|
||||||
|
nplaced = 0;
|
||||||
|
vm->m_data[i] = MapNode(biome->c_stone);
|
||||||
} else {
|
} else {
|
||||||
have_air = false;
|
have_air = false;
|
||||||
nplaced = 0;
|
nplaced = 0;
|
||||||
}
|
}
|
||||||
|
} else if (c == c_stone) {
|
||||||
|
have_air = false;
|
||||||
|
nplaced = 0;
|
||||||
|
vm->m_data[i] = MapNode(biome->c_stone);
|
||||||
}
|
}
|
||||||
|
} else if (c == c_stone) {
|
||||||
|
have_air = false;
|
||||||
|
nplaced = 0;
|
||||||
|
vm->m_data[i] = MapNode(biome->c_stone);
|
||||||
} else if (c == c_water_source) {
|
} else if (c == c_water_source) {
|
||||||
have_air = true;
|
have_air = true;
|
||||||
nplaced = 0;
|
nplaced = 0;
|
||||||
|
@ -58,6 +58,7 @@ BiomeManager::BiomeManager(IGameDef *gamedef)
|
|||||||
|
|
||||||
resolver->addNode("air", "", CONTENT_AIR, &b->c_top);
|
resolver->addNode("air", "", CONTENT_AIR, &b->c_top);
|
||||||
resolver->addNode("air", "", CONTENT_AIR, &b->c_filler);
|
resolver->addNode("air", "", CONTENT_AIR, &b->c_filler);
|
||||||
|
resolver->addNode("mapgen_stone", "", CONTENT_AIR, &b->c_stone);
|
||||||
resolver->addNode("mapgen_water_source", "", CONTENT_AIR, &b->c_water);
|
resolver->addNode("mapgen_water_source", "", CONTENT_AIR, &b->c_water);
|
||||||
resolver->addNode("air", "", CONTENT_AIR, &b->c_dust);
|
resolver->addNode("air", "", CONTENT_AIR, &b->c_dust);
|
||||||
resolver->addNode("mapgen_water_source", "", CONTENT_AIR, &b->c_dust_water);
|
resolver->addNode("mapgen_water_source", "", CONTENT_AIR, &b->c_dust_water);
|
||||||
@ -112,3 +113,4 @@ Biome *BiomeManager::getBiome(float heat, float humidity, s16 y)
|
|||||||
|
|
||||||
return biome_closest ? biome_closest : (Biome *)m_elements[0];
|
return biome_closest ? biome_closest : (Biome *)m_elements[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ public:
|
|||||||
|
|
||||||
content_t c_top;
|
content_t c_top;
|
||||||
content_t c_filler;
|
content_t c_filler;
|
||||||
|
content_t c_stone;
|
||||||
content_t c_water;
|
content_t c_water;
|
||||||
content_t c_dust;
|
content_t c_dust;
|
||||||
content_t c_dust_water;
|
content_t c_dust_water;
|
||||||
@ -77,3 +78,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "mg_ore.h"
|
#include "mg_ore.h"
|
||||||
#include "mg_decoration.h"
|
#include "mg_decoration.h"
|
||||||
#include "mg_schematic.h"
|
#include "mg_schematic.h"
|
||||||
|
#include "mapgen_v5.h"
|
||||||
#include "mapgen_v7.h"
|
#include "mapgen_v7.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
@ -336,6 +337,8 @@ int ModApiMapgen::l_register_biome(lua_State *L)
|
|||||||
"mapgen_dirt_with_grass", CONTENT_AIR, &b->c_top);
|
"mapgen_dirt_with_grass", CONTENT_AIR, &b->c_top);
|
||||||
resolver->addNode(getstringfield_default(L, index, "node_filler", ""),
|
resolver->addNode(getstringfield_default(L, index, "node_filler", ""),
|
||||||
"mapgen_dirt", CONTENT_AIR, &b->c_filler);
|
"mapgen_dirt", CONTENT_AIR, &b->c_filler);
|
||||||
|
resolver->addNode(getstringfield_default(L, index, "node_stone", ""),
|
||||||
|
"mapgen_stone", CONTENT_AIR, &b->c_stone);
|
||||||
resolver->addNode(getstringfield_default(L, index, "node_water", ""),
|
resolver->addNode(getstringfield_default(L, index, "node_water", ""),
|
||||||
"mapgen_water_source", CONTENT_AIR, &b->c_water);
|
"mapgen_water_source", CONTENT_AIR, &b->c_water);
|
||||||
resolver->addNode(getstringfield_default(L, index, "node_dust", ""),
|
resolver->addNode(getstringfield_default(L, index, "node_dust", ""),
|
||||||
|
Loading…
Reference in New Issue
Block a user