diff options
author | paramat <paramat@users.noreply.github.com> | 2017-10-08 21:08:52 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-10-09 18:27:17 +0100 |
commit | 0c9ca27ffce7d53ede74bd6ccbf590d1cbe94b7b (patch) | |
tree | b0e569ad1509bce616083e38794a64cf4017c226 /src/mg_decoration.cpp | |
parent | 17016090e38cc44e58517129278c28dd7943b4cc (diff) | |
download | hax-minetest-server-0c9ca27ffce7d53ede74bd6ccbf590d1cbe94b7b.tar.gz hax-minetest-server-0c9ca27ffce7d53ede74bd6ccbf590d1cbe94b7b.zip |
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.
Diffstat (limited to 'src/mg_decoration.cpp')
-rw-r--r-- | src/mg_decoration.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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; |