mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 11:33:44 +01:00
Mgv6 mudflow: Remove decoration if 'dirt with grass' below flows away (#5798)
Mudflow of a neighbouring mapchunk extends into a mapchunk's edge, and could remove 'dirt with grass' from under a decoration, creating unsupported decorations. Remove any decoration above if a 'dirt with grass' node is removed by mudflow.
This commit is contained in:
parent
2f291e6685
commit
5b338638e0
@ -836,13 +836,17 @@ void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos)
|
|||||||
v3s16(-1, 0, 0), // left
|
v3s16(-1, 0, 0), // left
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check that upper is air or doesn't exist.
|
// Check that upper is walkable. Cancel
|
||||||
// Cancel dropping if upper keeps it in place
|
// dropping if upper keeps it in place.
|
||||||
u32 i3 = i;
|
u32 i3 = i;
|
||||||
vm->m_area.add_y(em, i3, 1);
|
vm->m_area.add_y(em, i3, 1);
|
||||||
if (vm->m_area.contains(i3) == true &&
|
MapNode *n3 = NULL;
|
||||||
ndef->get(vm->m_data[i3]).walkable)
|
|
||||||
continue;
|
if (vm->m_area.contains(i3)) {
|
||||||
|
n3 = &vm->m_data[i3];
|
||||||
|
if (ndef->get(*n3).walkable)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Drop mud on side
|
// Drop mud on side
|
||||||
for (u32 di = 0; di < 4; di++) {
|
for (u32 di = 0; di < 4; di++) {
|
||||||
@ -885,10 +889,18 @@ void MapgenV6::flowMud(s16 &mudflow_minpos, s16 &mudflow_maxpos)
|
|||||||
if (!dropped_to_unknown) {
|
if (!dropped_to_unknown) {
|
||||||
*n2 = *n;
|
*n2 = *n;
|
||||||
// Set old place to be air (or water)
|
// Set old place to be air (or water)
|
||||||
if (old_is_water)
|
if (old_is_water) {
|
||||||
*n = MapNode(c_water_source);
|
*n = MapNode(c_water_source);
|
||||||
else
|
} else {
|
||||||
*n = MapNode(CONTENT_AIR);
|
*n = MapNode(CONTENT_AIR);
|
||||||
|
// Upper (n3) is not walkable or is NULL. If it is
|
||||||
|
// not NULL and not air and not water it is a
|
||||||
|
// decoration that needs removing, to avoid
|
||||||
|
// unsupported decorations.
|
||||||
|
if (n3 && n3->getContent() != CONTENT_AIR &&
|
||||||
|
n3->getContent() != c_water_source)
|
||||||
|
*n3 = MapNode(CONTENT_AIR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
|
Loading…
Reference in New Issue
Block a user