aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2018-02-23 08:54:03 +0000
committerparamat <mat.gregory@virginmedia.com>2018-03-09 03:16:25 +0000
commitcbb9301bea9d869a7d11f810fb320d93f6d31460 (patch)
tree8aa8761e21d9a27e501214c61af4f5a6cf865095 /src/script/lua_api
parentc7c03ad7a60b77040d0dfc360a79f065e0c2c971 (diff)
downloadminetest-cbb9301bea9d869a7d11f810fb320d93f6d31460.tar.gz
minetest-cbb9301bea9d869a7d11f810fb320d93f6d31460.tar.bz2
minetest-cbb9301bea9d869a7d11f810fb320d93f6d31460.zip
Biomes: Add 'min_pos'/'max_pos' xyz biome limits
'y_min' and 'y_max' are still accepted for compatibility.
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_mapgen.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index 5bd49e386..11d963b4d 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -388,12 +388,15 @@ Biome *read_biome_def(lua_State *L, int index, const NodeDefManager *ndef)
b->depth_filler = getintfield_default(L, index, "depth_filler", -31000);
b->depth_water_top = getintfield_default(L, index, "depth_water_top", 0);
b->depth_riverbed = getintfield_default(L, index, "depth_riverbed", 0);
- b->y_min = getintfield_default(L, index, "y_min", -31000);
- b->y_max = getintfield_default(L, index, "y_max", 31000);
b->heat_point = getfloatfield_default(L, index, "heat_point", 0.f);
b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.f);
b->vertical_blend = getintfield_default(L, index, "vertical_blend", 0);
- b->flags = 0; //reserved
+ b->flags = 0; // reserved
+
+ b->min_pos = getv3s16field_default(L, index, "min_pos", v3s16(-31000, -31000, -31000));
+ getintfield(L, index, "y_min", b->min_pos.Y);
+ b->max_pos = getv3s16field_default(L, index, "max_pos", v3s16(31000, 31000, 31000));
+ getintfield(L, index, "y_max", b->max_pos.Y);
std::vector<std::string> &nn = b->m_nodenames;
nn.push_back(getstringfield_default(L, index, "node_top", ""));
@@ -617,7 +620,7 @@ int ModApiMapgen::l_get_biome_data(lua_State *L)
if (!humidity)
return 0;
- Biome *biome = (Biome *)bmgr->getBiomeFromNoiseOriginal(heat, humidity, pos.Y);
+ Biome *biome = (Biome *)bmgr->getBiomeFromNoiseOriginal(heat, humidity, pos);
if (!biome || biome->index == OBJDEF_INVALID_INDEX)
return 0;
@@ -1041,7 +1044,7 @@ int ModApiMapgen::l_register_biome(lua_State *L)
luaL_checktype(L, index, LUA_TTABLE);
const NodeDefManager *ndef = getServer(L)->getNodeDefManager();
- BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
+ BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
Biome *biome = read_biome_def(L, index, ndef);
if (!biome)