aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/lua_api.txt4
-rw-r--r--src/mg_decoration.cpp2
-rw-r--r--src/mg_decoration.h1
-rw-r--r--src/script/lua_api/l_mapgen.cpp7
4 files changed, 12 insertions, 2 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index bab3e11f7..62cd6bb46 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -4040,8 +4040,10 @@ The Biome API is still in an experimental phase and subject to change.
-- ^ Number of nodes high the decoration is made.
-- ^ If height_max is not 0, this is the lower bound of the randomly selected height.
height_max = 0,
- -- ^ Number of nodes the decoration can be at maximum.
+ -- ^ Number of nodes the decoration can be at maximum.
-- ^ If absent, the parameter 'height' is used as a constant.
+ param2 = 0,
+ -- ^ Param2 value of placed decoration node.
----- Schematic-type parameters
schematic = "foobar.mts",
diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp
index 92483abc3..51e4fbbcc 100644
--- a/src/mg_decoration.cpp
+++ b/src/mg_decoration.cpp
@@ -315,7 +315,7 @@ size_t DecoSimple::generate(MMVManip *vm, PcgRandom *pr, v3s16 p)
!force_placement)
break;
- vm->m_data[vi] = MapNode(c_place);
+ vm->m_data[vi] = MapNode(c_place, 0, deco_param2);
}
return 1;
diff --git a/src/mg_decoration.h b/src/mg_decoration.h
index be0ba44d7..986328ec3 100644
--- a/src/mg_decoration.h
+++ b/src/mg_decoration.h
@@ -100,6 +100,7 @@ public:
std::vector<content_t> c_decos;
s16 deco_height;
s16 deco_height_max;
+ u8 deco_param2;
};
class DecoSchematic : public Decoration {
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index da8e71cdc..cefea3da9 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -975,6 +975,7 @@ bool read_deco_simple(lua_State *L, DecoSimple *deco)
deco->deco_height = getintfield_default(L, index, "height", 1);
deco->deco_height_max = getintfield_default(L, index, "height_max", 0);
+ deco->deco_param2 = getintfield_default(L, index, "param2", 0);
if (deco->deco_height <= 0) {
errorstream << "register_decoration: simple decoration height"
@@ -990,6 +991,12 @@ bool read_deco_simple(lua_State *L, DecoSimple *deco)
return false;
}
+ if ((deco->deco_param2 < 0) || (deco->deco_param2 > 255)) {
+ errorstream << "register_decoration: param2 out of bounds (0-255)"
+ << std::endl;
+ return false;
+ }
+
return true;
}