summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_mapgen.cpp
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2017-10-09 20:13:10 +0100
committerparamat <mat.gregory@virginmedia.com>2017-10-10 19:57:28 +0100
commit9a41a3d0f1b5f2bcd16b61122f6a34434fea7a7d (patch)
tree666efb4dde4718d93ad13b61b0019eb123b656f7 /src/script/lua_api/l_mapgen.cpp
parent2cf9014160085303cda333334784ac4938edc086 (diff)
downloadminetest-9a41a3d0f1b5f2bcd16b61122f6a34434fea7a7d.tar.gz
minetest-9a41a3d0f1b5f2bcd16b61122f6a34434fea7a7d.tar.bz2
minetest-9a41a3d0f1b5f2bcd16b61122f6a34434fea7a7d.zip
Simple decorations: Make 'place_offset_y' usable with simple decorations
Necessary for placing the base cube of 'plantlike_rooted' drawtype in the seabed instead of on it. Useful for placing decorations sunk into, or buried in, the ground.
Diffstat (limited to 'src/script/lua_api/l_mapgen.cpp')
-rw-r--r--src/script/lua_api/l_mapgen.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index f475a8f7f..9ec4d5002 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -906,12 +906,13 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
return 0;
}
- deco->name = getstringfield_default(L, index, "name", "");
- deco->fill_ratio = getfloatfield_default(L, index, "fill_ratio", 0.02);
- deco->y_min = getintfield_default(L, index, "y_min", -31000);
- deco->y_max = getintfield_default(L, index, "y_max", 31000);
- deco->nspawnby = getintfield_default(L, index, "num_spawn_by", -1);
- deco->sidelen = getintfield_default(L, index, "sidelen", 8);
+ deco->name = getstringfield_default(L, index, "name", "");
+ deco->fill_ratio = getfloatfield_default(L, index, "fill_ratio", 0.02);
+ deco->y_min = getintfield_default(L, index, "y_min", -31000);
+ deco->y_max = getintfield_default(L, index, "y_max", 31000);
+ deco->nspawnby = getintfield_default(L, index, "num_spawn_by", -1);
+ deco->place_offset_y = getintfield_default(L, index, "place_offset_y", 0);
+ deco->sidelen = getintfield_default(L, index, "sidelen", 8);
if (deco->sidelen <= 0) {
errorstream << "register_decoration: sidelen must be "
"greater than 0" << std::endl;
@@ -1024,8 +1025,6 @@ bool read_deco_schematic(lua_State *L, SchematicManager *schemmgr, DecoSchematic
deco->rotation = (Rotation)getenumfield(L, index, "rotation",
ModApiMapgen::es_Rotation, ROTATE_0);
- deco->place_offset_y = getintfield_default(L, index, "place_offset_y", 0);
-
StringMap replace_names;
lua_getfield(L, index, "replacements");
if (lua_istable(L, -1))