forked from mtcontrib/plantlife_modpack
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:
parent
d7a64d7e52
commit
b80a7a9693
@ -339,9 +339,13 @@ function plantslib:generate_block_with_air_checking(dtime)
|
|||||||
|
|
||||||
if not plantslib.surface_nodes_aircheck.blockhash then
|
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)
|
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 = {}
|
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
|
plantslib.surface_nodes_aircheck.blockhash[#plantslib.surface_nodes_aircheck.blockhash + 1] = pos
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
plantslib.actioncount_aircheck.blockhash = 1
|
plantslib.actioncount_aircheck.blockhash = 1
|
||||||
|
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user