use find_nodes_in_area_under_air() if available

instead of manually searching for air above find_nodes_in_area() list
This commit is contained in:
Vanessa Ezekowitz 2015-02-27 11:48:51 -05:00
parent d7a64d7e52
commit b80a7a9693
1 changed files with 13 additions and 8 deletions

View File

@ -339,9 +339,13 @@ function plantslib:generate_block_with_air_checking(dtime)
if not plantslib.surface_nodes_aircheck.blockhash then
if type(minetest.find_nodes_in_area_under_air) == "function" then -- use newer API call
plantslib.surface_nodes_aircheck.blockhash =
minetest.find_nodes_in_area_under_air(minp, maxp, plantslib.surfaceslist_aircheck)
else
local search_area = minetest.find_nodes_in_area(minp, maxp, plantslib.surfaceslist_aircheck)
-- search the generated block for air-bounded surfaces
-- search the generated block for air-bounded surfaces the slow way.
plantslib.surface_nodes_aircheck.blockhash = {}
@ -352,6 +356,7 @@ function plantslib:generate_block_with_air_checking(dtime)
plantslib.surface_nodes_aircheck.blockhash[#plantslib.surface_nodes_aircheck.blockhash + 1] = pos
end
end
end
plantslib.actioncount_aircheck.blockhash = 1
else