aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-04-20 20:25:33 -0400
committerkwolekr <kwolekr@minetest.net>2015-04-20 20:25:33 -0400
commit46a2c1f167f76b1ceb0164e9028b67eb6bf76e79 (patch)
treeb9706af6c1d9631e2914128f8218ad6f6a6ee39b /src/script/lua_api
parenta443a13a9d77d3826947a55dd3bdc684d7bb7ed8 (diff)
downloadminetest-46a2c1f167f76b1ceb0164e9028b67eb6bf76e79.tar.gz
minetest-46a2c1f167f76b1ceb0164e9028b67eb6bf76e79.tar.bz2
minetest-46a2c1f167f76b1ceb0164e9028b67eb6bf76e79.zip
Ore: Add biomes parameter
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_mapgen.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index e90fe32c8..7057344ab 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -847,6 +847,7 @@ int ModApiMapgen::l_register_ore(lua_State *L)
luaL_checktype(L, index, LUA_TTABLE);
INodeDefManager *ndef = getServer(L)->getNodeDefManager();
+ BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
OreManager *oremgr = getServer(L)->getEmergeManager()->oremgr;
enum OreType oretype = (OreType)getenumfield(L, index,
@@ -866,6 +867,7 @@ int ModApiMapgen::l_register_ore(lua_State *L)
ore->noise = NULL;
ore->flags = 0;
+ //// Get y_min/y_max
warn_if_field_exists(L, index, "height_min",
"Deprecated: new name is \"y_min\".");
warn_if_field_exists(L, index, "height_max",
@@ -888,8 +890,16 @@ int ModApiMapgen::l_register_ore(lua_State *L)
return 0;
}
+ //// Get flags
getflagsfield(L, index, "flags", flagdesc_ore, &ore->flags, NULL);
+ //// Get biomes associated with this decoration (if any)
+ lua_getfield(L, index, "biomes");
+ if (get_biome_list(L, -1, bmgr, &ore->biomes))
+ errorstream << "register_ore: couldn't get all biomes " << std::endl;
+ lua_pop(L, 1);
+
+ //// Get noise parameters if needed
lua_getfield(L, index, "noise_params");
if (read_noiseparams(L, -1, &ore->np)) {
ore->flags |= OREFLAG_USE_NOISE;