aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2015-03-10 04:51:21 +0000
committerparamat <mat.gregory@virginmedia.com>2015-03-11 03:36:39 +0000
commitb2b6bbf3e80f0ab06d62c43567122871ae560534 (patch)
tree80be48b9c9b60b0e56bee57b901190758a27ea99 /src
parentadfcdc548491c87b3b24540c9d9a3a488198d1bc (diff)
downloadminetest-b2b6bbf3e80f0ab06d62c43567122871ae560534.tar.gz
minetest-b2b6bbf3e80f0ab06d62c43567122871ae560534.tar.bz2
minetest-b2b6bbf3e80f0ab06d62c43567122871ae560534.zip
lua_api/l_mapgen: Fix overlapping areas of minetest.generate_ores/decorations
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_mapgen.cpp16
-rw-r--r--src/script/lua_api/l_mapgen.h4
2 files changed, 12 insertions, 8 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index 54ec69010..e16b0153a 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -806,7 +806,7 @@ int ModApiMapgen::l_create_schematic(lua_State *L)
return 1;
}
-// generate_ores(vm, [ore_id])
+// generate_ores(vm, p1, p2, [ore_id])
int ModApiMapgen::l_generate_ores(lua_State *L)
{
EmergeManager *emerge = getServer(L)->getEmergeManager();
@@ -818,13 +818,15 @@ int ModApiMapgen::l_generate_ores(lua_State *L)
u32 blockseed = Mapgen::getBlockSeed(mg.vm->m_area.MinEdge, mg.seed);
- emerge->oremgr->placeAllOres(&mg, blockseed,
- mg.vm->m_area.MinEdge, mg.vm->m_area.MaxEdge);
+ v3s16 pmin = read_v3s16(L, 2);
+ v3s16 pmax = read_v3s16(L, 3);
+
+ emerge->oremgr->placeAllOres(&mg, blockseed, pmin, pmax);
return 0;
}
-// generate_decorations(vm, [deco_id])
+// generate_decorations(vm, p1, p2, [deco_id])
int ModApiMapgen::l_generate_decorations(lua_State *L)
{
EmergeManager *emerge = getServer(L)->getEmergeManager();
@@ -836,8 +838,10 @@ int ModApiMapgen::l_generate_decorations(lua_State *L)
u32 blockseed = Mapgen::getBlockSeed(mg.vm->m_area.MinEdge, mg.seed);
- emerge->decomgr->placeAllDecos(&mg, blockseed,
- mg.vm->m_area.MinEdge, mg.vm->m_area.MaxEdge);
+ v3s16 pmin = read_v3s16(L, 2);
+ v3s16 pmax = read_v3s16(L, 3);
+
+ emerge->decomgr->placeAllDecos(&mg, blockseed, pmin, pmax);
return 0;
}
diff --git a/src/script/lua_api/l_mapgen.h b/src/script/lua_api/l_mapgen.h
index e17d1b85a..dfed8475f 100644
--- a/src/script/lua_api/l_mapgen.h
+++ b/src/script/lua_api/l_mapgen.h
@@ -62,10 +62,10 @@ private:
// clear_registered_decorations()
static int l_clear_registered_decorations(lua_State *L);
- // generate_ores(vm)
+ // generate_ores(vm, p1, p2)
static int l_generate_ores(lua_State *L);
- // generate_decorations(vm)
+ // generate_decorations(vm, p1, p2)
static int l_generate_decorations(lua_State *L);
// clear_registered_ores