]> git.lizzy.rs Git - worldedit.git/commitdiff
Don't mark or load areas into memory when they are over a certain size, fixes #97
authorsfan5 <sfan5@live.de>
Sat, 10 Dec 2016 21:02:40 +0000 (22:02 +0100)
committersfan5 <sfan5@live.de>
Sat, 10 Dec 2016 21:02:40 +0000 (22:02 +0100)
worldedit_commands/mark.lua

index 7f880ea61635f448bbd563317fc5b855d623e133..79451d6e9118128fc39e4b98d85b76d5947bf85e 100644 (file)
@@ -58,8 +58,19 @@ worldedit.mark_region = function(name)
                end\r
                worldedit.marker_region[name] = nil\r
        end\r
+\r
        if pos1 ~= nil and pos2 ~= nil then\r
                local pos1, pos2 = worldedit.sort_pos(pos1, pos2)\r
+\r
+               local vec = vector.subtract(pos2, pos1)\r
+               local maxside = math.max(vec.x, math.max(vec.y, vec.z))\r
+               local limit = tonumber(minetest.setting_get("active_object_send_range_blocks")) * 16\r
+               if maxside > limit * 1.5 then\r
+                       -- The client likely won't be able to see the plane markers as intended anyway,\r
+                       -- thus don't place them and also don't load the area into memory\r
+                       return\r
+               end\r
+\r
                local thickness = 0.2\r
                local sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2\r
 \r