Skip to content

Commit 0351c66

Browse files
committed
Use new VoxelManip cleanup API
1 parent a6bf9dd commit 0351c66

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

mods/carts/functions.lua

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,9 @@ end
4141
function carts:is_rail(pos, railtype)
4242
local node = minetest.get_node(pos).name
4343
if node == "ignore" then
44-
local vm = minetest.get_voxel_manip()
45-
local emin, emax = vm:read_from_map(pos, pos)
46-
local area = VoxelArea:new{
47-
MinEdge = emin,
48-
MaxEdge = emax,
49-
}
50-
local data = vm:get_data()
51-
local vi = area:indexp(pos)
52-
node = minetest.get_name_from_content_id(data[vi])
44+
-- we really need to know, so load it
45+
minetest.load_area(pos)
46+
node = minetest.get_node(pos).name
5347
end
5448
if minetest.get_item_group(node, "rail") == 0 then
5549
return false

mods/default/trees.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ function default.grow_tree(pos, is_apple_tree, bad)
132132

133133
vm:set_data(data)
134134
vm:write_to_map()
135-
vm:update_map()
135+
if vm.close ~= nil then
136+
vm:close()
137+
end
136138
end
137139

138140
-- Jungle tree
@@ -184,7 +186,9 @@ function default.grow_jungle_tree(pos, bad)
184186

185187
vm:set_data(data)
186188
vm:write_to_map()
187-
vm:update_map()
189+
if vm.close ~= nil then
190+
vm:close()
191+
end
188192
end
189193

190194

@@ -310,7 +314,9 @@ function default.grow_pine_tree(pos, snow)
310314

311315
vm:set_data(data)
312316
vm:write_to_map()
313-
vm:update_map()
317+
if vm.close ~= nil then
318+
vm:close()
319+
end
314320
end
315321

316322

mods/tnt/init.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
332332

333333
vm1:set_data(data)
334334
vm1:write_to_map()
335+
if vm1.close ~= nil then
336+
vm1:close()
337+
end
335338

336339
-- recalculate new radius
337340
radius = math.floor(radius * math.pow(count, 1/3))
@@ -386,8 +389,10 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
386389

387390
vm:set_data(data)
388391
vm:write_to_map()
389-
vm:update_map()
390392
vm:update_liquids()
393+
if vm.close ~= nil then
394+
vm:close()
395+
end
391396

392397
-- call check_single_for_falling for everything within 1.5x blast radius
393398
for y = -radius * 1.5, radius * 1.5 do

0 commit comments

Comments
 (0)