From 0c9ca27ffce7d53ede74bd6ccbf590d1cbe94b7b Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 8 Oct 2017 21:08:52 +0100 Subject: 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. --- src/mg_decoration.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mg_decoration.cpp') diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp index 094694e44..cb4705177 100644 --- a/src/mg_decoration.cpp +++ b/src/mg_decoration.cpp @@ -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; -- cgit v1.2.3