1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Simple decorations: Add 'param2_max' parameter for random param2

If 'param2_max' is not used, parameter 'param2' works as before for
compatibility.
If 'param2_max' is used, 'param2' and 'param2_max' become the lower
and upper bounds of a per-decoration random param2.
This commit is contained in:
paramat 2017-10-08 21:08:52 +01:00 committed by paramat
parent 17016090e3
commit 0c9ca27ffc
4 changed files with 17 additions and 3 deletions

View file

@ -227,6 +227,9 @@ size_t DecoSimple::generate(MMVManip *vm, PcgRandom *pr, v3s16 p)
s16 height = (deco_height_max > 0) ?
pr->range(deco_height, deco_height_max) : deco_height;
u8 param2 = (deco_param2_max > 0) ?
pr->range(deco_param2, deco_param2_max) : deco_param2;
bool force_placement = (flags & DECO_FORCE_PLACEMENT);
const v3s16 &em = vm->m_area.getExtent();
@ -239,7 +242,7 @@ size_t DecoSimple::generate(MMVManip *vm, PcgRandom *pr, v3s16 p)
!force_placement)
break;
vm->m_data[vi] = MapNode(c_place, 0, deco_param2);
vm->m_data[vi] = MapNode(c_place, 0, param2);
}
return 1;