mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 22:52:25 +01:00
Decoration: Place decorations in mgv6, check if air or cignore before placement
This commit is contained in:
parent
261f559339
commit
f18b4872ea
@ -421,7 +421,7 @@ void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, s16 start_y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t ndecos = c_decolist.size();
|
size_t ndecos = c_decolist.size();
|
||||||
content_t c = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco;
|
content_t c_place = ndecos ? c_decolist[pr->range(0, ndecos - 1)] : c_deco;
|
||||||
|
|
||||||
s16 height = (deco_height_max > 0) ?
|
s16 height = (deco_height_max > 0) ?
|
||||||
pr->range(deco_height, deco_height_max) : deco_height;
|
pr->range(deco_height, deco_height_max) : deco_height;
|
||||||
@ -431,7 +431,12 @@ void DecoSimple::generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, s16 start_y,
|
|||||||
v3s16 em = vm->m_area.getExtent();
|
v3s16 em = vm->m_area.getExtent();
|
||||||
for (int i = start_y; i < height; i++) {
|
for (int i = start_y; i < height; i++) {
|
||||||
vm->m_area.add_y(em, vi, 1);
|
vm->m_area.add_y(em, vi, 1);
|
||||||
vm->m_data[vi] = MapNode(c);
|
|
||||||
|
content_t c = vm->m_data[vi].getContent();
|
||||||
|
if (c != CONTENT_AIR && c != CONTENT_IGNORE)
|
||||||
|
break;
|
||||||
|
|
||||||
|
vm->m_data[vi] = MapNode(c_place);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,6 +446,12 @@ void MapgenV6::makeChunk(BlockMakeData *data) {
|
|||||||
if (flags & MG_TREES)
|
if (flags & MG_TREES)
|
||||||
placeTreesAndJungleGrass();
|
placeTreesAndJungleGrass();
|
||||||
|
|
||||||
|
// Generate the registered decorations
|
||||||
|
for (unsigned int i = 0; i != emerge->decorations.size(); i++) {
|
||||||
|
Decoration *deco = emerge->decorations[i];
|
||||||
|
deco->placeDeco(this, blockseed + i, node_min, node_max);
|
||||||
|
}
|
||||||
|
|
||||||
// Generate the registered ores
|
// Generate the registered ores
|
||||||
for (unsigned int i = 0; i != emerge->ores.size(); i++) {
|
for (unsigned int i = 0; i != emerge->ores.size(); i++) {
|
||||||
Ore *ore = emerge->ores[i];
|
Ore *ore = emerge->ores[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user