diff options
author | paramat <paramat@users.noreply.github.com> | 2018-02-21 14:34:06 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2018-02-21 15:54:06 +0000 |
commit | 673f7196a2200a8f77d04a0470f642f729a4f94b (patch) | |
tree | 011134c2ad60ff04575887be82bfd0a2d97ab9f3 /src/script/lua_api | |
parent | 5652edea3be82e4f43f59722b766cff6a229f0f0 (diff) | |
download | minetest-673f7196a2200a8f77d04a0470f642f729a4f94b.tar.gz minetest-673f7196a2200a8f77d04a0470f642f729a4f94b.tar.bz2 minetest-673f7196a2200a8f77d04a0470f642f729a4f94b.zip |
Find nodes in area (under air): Raise volume limit and document it
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 7ea8b64b5..6d45d6c49 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -801,14 +801,10 @@ int ModApiEnvMod::l_find_nodes_in_area(lua_State *L) sortBoxVerticies(minp, maxp); v3s16 cube = maxp - minp + 1; - - /* Limit for too large areas, assume default values - * and give tolerances of 1 node on each side - * (chunksize * MAP_BLOCKSIZE + 2)^3 = 551368 - */ - if ((u64)cube.X * (u64)cube.Y * (u64)cube.Z > 551368) { + // Volume limit equal to 8 default mapchunks, (80 * 2) ^ 3 = 4,096,000 + if ((u64)cube.X * (u64)cube.Y * (u64)cube.Z > 4096000) { luaL_error(L, "find_nodes_in_area(): area volume" - " exceeds allowed value of 551368"); + " exceeds allowed value of 4096000"); return 0; } @@ -873,14 +869,10 @@ int ModApiEnvMod::l_find_nodes_in_area_under_air(lua_State *L) sortBoxVerticies(minp, maxp); v3s16 cube = maxp - minp + 1; - - /* Limit for too large areas, assume default values - * and give tolerances of 1 node on each side - * (chunksize * MAP_BLOCKSIZE + 2)^3 = 551368 - */ - if ((u64)cube.X * (u64)cube.Y * (u64)cube.Z > 551368) { + // Volume limit equal to 8 default mapchunks, (80 * 2) ^ 3 = 4,096,000 + if ((u64)cube.X * (u64)cube.Y * (u64)cube.Z > 4096000) { luaL_error(L, "find_nodes_in_area_under_air(): area volume" - " exceeds allowed value of 551368"); + " exceeds allowed value of 4096000"); return 0; } |