Open cx384 opened 2 months ago
DecoSimple: aborts as soon as non-air and non-ignore is found. https://github.com/minetest/minetest/blob/733a019bf5aefddb824e5643b791ca25fc620b03/src/mapgen/mg_decoration.cpp#L375-L376
Schematic: only ignore and air nodes are replaced. Perhaps an early abort would be more suitable because currently it appears like nodes were replaced. https://github.com/minetest/minetest/blob/733a019bf5aefddb824e5643b791ca25fc620b03/src/mapgen/mg_schematic.cpp#L186-L191
As far as I can see there's no such check in make_ltree
(unhandled force placement option).
Hence this testing code might depend on the mod loading order, which affects the decoration placement order.
EDIT: to solve this issue in every case, the following flag concept could be used: (see also: dungeon gen)
#define VMANIP_FLAG_DECO_GENERATED VOXELFLAG_CHECKED1
vm->clearFlag(VMANIP_FLAG_DECO_GENERATED);
// in Decoration::canPlaceDecoration
if (vm->m_flags[vi] & VMANIP_FLAG_DECO_GENERATED)
return false;
// in *::generate(..)
vm->m_flags[vi] |= VMANIP_FLAG_DECO_GENERATED;
For the schematic, if you do not specify force_place
it is somewhat intentional that this gets corrupted, and by not specifying flags to select floors, you will ask it to rely on the heightmap (which does not get updated by the cobble decoration you placed before). I believe all_floors
might help, too.
I am not saying the decoration placement is flawless, or easy to understand, or well-documented (see #14919 and #15012 - in particular order-dependent randomness is a pain), but to some extend you "got what you asked for". You probably wanted flags = "force_placement, all_floors"
.
Summary
When two decorations get generated at the same position, the second one overrides parts of the first one, resulting e.g. in a tree where the lowest trunk becomes a grass node.
It only happens for deco_type
schematic
andlsystem
, but not for two decorations of typesimple
with e.g. one ofheight = 2
.This is not the same problem as #14919, since the priority does not prevent a later decoration of type
schematic
andlsystem
from being generated, they just override each other resulting in corrupted structures. A solution would have to somehow take already generated decorations into account before generating new ones.Also relevant #11774
Steps to reproduce
Use this in MTG: