Increase entity check radius by 0.03 and add automatic drawer check (#29)

This commit is contained in:
Alex 2019-04-21 02:37:27 -07:00 committed by Linus Jahn (LNJ)
parent 88c4057579
commit d972c830fc
2 changed files with 8 additions and 2 deletions

@ -197,7 +197,7 @@ function drawers.spawn_visuals(pos)
end
function drawers.remove_visuals(pos)
local objs = core.get_objects_inside_radius(pos, 0.537)
local objs = core.get_objects_inside_radius(pos, 0.54)
if not objs then return end
for _, obj in pairs(objs) do

@ -77,6 +77,12 @@ core.register_entity("drawers:visual", {
self.drawerType = drawers.last_drawer_type
end
local node = minetest.get_node(self.object:get_pos())
if not node.name:match("^drawers:") then
self.object:remove()
return
end
-- add self to public drawer visuals
-- this is needed because there is no other way to get this class
-- only the underlying LuaEntitySAO
@ -385,7 +391,7 @@ core.register_lbm({
-- count the drawer visuals
local drawerType = core.registered_nodes[node.name].groups.drawer
local foundVisuals = 0
local objs = core.get_objects_inside_radius(pos, 0.537)
local objs = core.get_objects_inside_radius(pos, 0.54)
if objs then
for _, obj in pairs(objs) do
if obj and obj:get_luaentity() and