Skip to content

Commit

Permalink
Increase entity check radius by 0.03 and add automatic drawer check (#29
Browse files Browse the repository at this point in the history
)
  • Loading branch information
GreenXenith authored and lnjX committed Apr 21, 2019
1 parent 88c4057 commit d972c83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion lua/visual.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d972c83

Please sign in to comment.