mirror of
https://github.com/minetest/minetest_game.git
synced 2025-06-06 19:50:21 +02:00
Use new VoxelManip cleanup API
This commit is contained in:
parent
a6bf9dd526
commit
0351c66915
@ -41,15 +41,9 @@ end
|
|||||||
function carts:is_rail(pos, railtype)
|
function carts:is_rail(pos, railtype)
|
||||||
local node = minetest.get_node(pos).name
|
local node = minetest.get_node(pos).name
|
||||||
if node == "ignore" then
|
if node == "ignore" then
|
||||||
local vm = minetest.get_voxel_manip()
|
-- we really need to know, so load it
|
||||||
local emin, emax = vm:read_from_map(pos, pos)
|
minetest.load_area(pos)
|
||||||
local area = VoxelArea:new{
|
node = minetest.get_node(pos).name
|
||||||
MinEdge = emin,
|
|
||||||
MaxEdge = emax,
|
|
||||||
}
|
|
||||||
local data = vm:get_data()
|
|
||||||
local vi = area:indexp(pos)
|
|
||||||
node = minetest.get_name_from_content_id(data[vi])
|
|
||||||
end
|
end
|
||||||
if minetest.get_item_group(node, "rail") == 0 then
|
if minetest.get_item_group(node, "rail") == 0 then
|
||||||
return false
|
return false
|
||||||
|
@ -132,7 +132,9 @@ function default.grow_tree(pos, is_apple_tree, bad)
|
|||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
vm:update_map()
|
if vm.close ~= nil then
|
||||||
|
vm:close()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Jungle tree
|
-- Jungle tree
|
||||||
@ -184,7 +186,9 @@ function default.grow_jungle_tree(pos, bad)
|
|||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
vm:update_map()
|
if vm.close ~= nil then
|
||||||
|
vm:close()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -310,7 +314,9 @@ function default.grow_pine_tree(pos, snow)
|
|||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
vm:update_map()
|
if vm.close ~= nil then
|
||||||
|
vm:close()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,6 +332,9 @@ local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast, owne
|
|||||||
|
|
||||||
vm1:set_data(data)
|
vm1:set_data(data)
|
||||||
vm1:write_to_map()
|
vm1:write_to_map()
|
||||||
|
if vm1.close ~= nil then
|
||||||
|
vm1:close()
|
||||||
|
end
|
||||||
|
|
||||||
-- recalculate new radius
|
-- recalculate new radius
|
||||||
radius = math.floor(radius * math.pow(count, 1/3))
|
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
|
|||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
vm:update_map()
|
|
||||||
vm:update_liquids()
|
vm:update_liquids()
|
||||||
|
if vm.close ~= nil then
|
||||||
|
vm:close()
|
||||||
|
end
|
||||||
|
|
||||||
-- call check_single_for_falling for everything within 1.5x blast radius
|
-- call check_single_for_falling for everything within 1.5x blast radius
|
||||||
for y = -radius * 1.5, radius * 1.5 do
|
for y = -radius * 1.5, radius * 1.5 do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user