aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-09-13 00:09:00 -0400
committerkwolekr <kwolekr@minetest.net>2015-09-13 00:11:50 -0400
commitbeba96941365a750f8b681df7a73566bdf797f0c (patch)
tree74bfb88c53b4584f757c37e1d1360cc317ea3b94 /src/script/lua_api
parent1d6911676e8e9eadba76ef9f170d750fe6fa31bc (diff)
downloadminetest-beba96941365a750f8b681df7a73566bdf797f0c.tar.gz
minetest-beba96941365a750f8b681df7a73566bdf797f0c.tar.bz2
minetest-beba96941365a750f8b681df7a73566bdf797f0c.zip
Ore: Add ore sheet column height range selection
Modders are now able to select the range of ore column height, and the midpoint at which they 'grow' starting from. This commit adds three new parameters for the 'sheet' ore type: column_height_min, column_height_max, and column_midpoint_factor. clust_size is now deprecated for this ore type.
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_mapgen.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index d30b68054..9050816bb 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -937,8 +937,19 @@ int ModApiMapgen::l_register_ore(lua_State *L)
}
lua_pop(L, 1);
- if (oretype == ORE_VEIN) {
+ //// Get type-specific parameters
+ if (oretype == ORE_SHEET) {
+ OreSheet *oresheet = (OreSheet *)ore;
+
+ oresheet->column_height_min = getintfield_default(L, index,
+ "column_height_min", 1);
+ oresheet->column_height_max = getintfield_default(L, index,
+ "column_height_max", ore->clust_size);
+ oresheet->column_midpoint_factor = getfloatfield_default(L, index,
+ "column_midpoint_factor", 0.5f);
+ } else if (oretype == ORE_VEIN) {
OreVein *orevein = (OreVein *)ore;
+
orevein->random_factor = getfloatfield_default(L, index,
"random_factor", 1.f);
}