diff options
author | sfan5 <sfan5@live.de> | 2016-12-10 22:02:40 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2016-12-10 22:02:40 +0100 |
commit | 83288c969ee29a62f3babcb00cfa5fa5394d7c67 (patch) | |
tree | 84e0059826fa8f2d489309031b2bb9ca6ff01fe6 | |
parent | f9311b2b15b2a63845d551be6aaab1d056262fe1 (diff) |
Don't mark or load areas into memory when they are over a certain size, fixes #97
-rw-r--r-- | worldedit_commands/mark.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/worldedit_commands/mark.lua b/worldedit_commands/mark.lua index 7f880ea..79451d6 100644 --- a/worldedit_commands/mark.lua +++ b/worldedit_commands/mark.lua @@ -58,8 +58,19 @@ worldedit.mark_region = function(name) end
worldedit.marker_region[name] = nil
end
+
if pos1 ~= nil and pos2 ~= nil then
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
+
+ local vec = vector.subtract(pos2, pos1)
+ local maxside = math.max(vec.x, math.max(vec.y, vec.z))
+ local limit = tonumber(minetest.setting_get("active_object_send_range_blocks")) * 16
+ if maxside > limit * 1.5 then
+ -- The client likely won't be able to see the plane markers as intended anyway,
+ -- thus don't place them and also don't load the area into memory
+ return
+ end
+
local thickness = 0.2
local sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2
|