diff options
author | paramat <paramat@users.noreply.github.com> | 2018-02-21 14:34:06 +0000 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2018-06-03 17:32:00 +0200 |
commit | c683e050d45285f38f822f04eeb65ad6c604c119 (patch) | |
tree | e249218a0ad7404e361c820984c8929a55d1a532 /src/script | |
parent | c2e39b9363f6a7df81a63c20912c8c469a480a0c (diff) | |
download | minetest-c683e050d45285f38f822f04eeb65ad6c604c119.tar.gz minetest-c683e050d45285f38f822f04eeb65ad6c604c119.tar.bz2 minetest-c683e050d45285f38f822f04eeb65ad6c604c119.zip |
Find nodes in area (under air): Raise volume limit and document it
Diffstat (limited to 'src/script')
-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 46745facd..4a7885da7 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -655,14 +655,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; } @@ -723,14 +719,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; } |