Skip to content

Commit 7066735

Browse files
sfan5MoNTE48
authored andcommitted
Make use of minetest.load_area
1 parent ded9ea8 commit 7066735

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

worldedit/common.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,15 @@ end
4747

4848
function worldedit.keep_loaded(pos1, pos2)
4949
-- Create a vmanip and read the area from map, this
50-
-- causes all MapBlocks to be loaded into memory.
50+
-- causes all MapBlocks to be loaded into memory synchronously.
5151
-- This doesn't actually *keep* them loaded, unlike the name implies.
52-
local manip = minetest.get_voxel_manip()
53-
manip:read_from_map(pos1, pos2)
52+
if minetest.load_area then
53+
-- same effect but without unnecessary data copying
54+
minetest.load_area(pos1, pos2)
55+
else
56+
local manip = minetest.get_voxel_manip()
57+
manip:read_from_map(pos1, pos2)
58+
end
5459
end
5560

5661

0 commit comments

Comments
 (0)