Add local copy of minetest.find_nodes_in_area.

This commit is contained in:
kabou 2022-03-02 15:25:03 +01:00
parent df5d24104d
commit 86a4ece7d2
2 changed files with 7 additions and 5 deletions

@ -26,10 +26,12 @@ function mcl_burning.get_collisionbox(obj, smaller, storage)
end end
end end
local find_nodes_in_area = minetest.find_nodes_in_area
function mcl_burning.get_touching_nodes(obj, nodenames, storage) function mcl_burning.get_touching_nodes(obj, nodenames, storage)
local pos = obj:get_pos() local pos = obj:get_pos()
local minp, maxp = mcl_burning.get_collisionbox(obj, true, storage) local minp, maxp = mcl_burning.get_collisionbox(obj, true, storage)
local nodes = minetest.find_nodes_in_area(vector.add(pos, minp), vector.add(pos, maxp), nodenames) local nodes = find_nodes_in_area(vector.add(pos, minp), vector.add(pos, maxp), nodenames)
return nodes return nodes
end end

@ -1,15 +1,15 @@
local modpath = minetest.get_modpath(minetest.get_current_modname()) local modpath = minetest.get_modpath(minetest.get_current_modname())
local pairs = pairs
local get_connected_players = minetest.get_connected_players
local get_item_group = minetest.get_item_group
mcl_burning = { mcl_burning = {
storage = {} storage = {}
} }
dofile(modpath .. "/api.lua") dofile(modpath .. "/api.lua")
local pairs = pairs
local get_connected_players = minetest.get_connected_players
local get_item_group = minetest.get_item_group
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
for _, player in pairs(get_connected_players()) do for _, player in pairs(get_connected_players()) do
local storage = mcl_burning.storage[player] local storage = mcl_burning.storage[player]