mirror of
https://github.com/minetest-mods/drawers.git
synced 2024-11-22 14:43:45 +01:00
Increase entity check radius by 0.03 and add automatic drawer check (#29)
This commit is contained in:
parent
88c4057579
commit
d972c830fc
@ -197,7 +197,7 @@ function drawers.spawn_visuals(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function drawers.remove_visuals(pos)
|
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
|
if not objs then return end
|
||||||
|
|
||||||
for _, obj in pairs(objs) do
|
for _, obj in pairs(objs) do
|
||||||
|
@ -77,6 +77,12 @@ core.register_entity("drawers:visual", {
|
|||||||
self.drawerType = drawers.last_drawer_type
|
self.drawerType = drawers.last_drawer_type
|
||||||
end
|
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
|
-- add self to public drawer visuals
|
||||||
-- this is needed because there is no other way to get this class
|
-- this is needed because there is no other way to get this class
|
||||||
-- only the underlying LuaEntitySAO
|
-- only the underlying LuaEntitySAO
|
||||||
@ -385,7 +391,7 @@ core.register_lbm({
|
|||||||
-- count the drawer visuals
|
-- count the drawer visuals
|
||||||
local drawerType = core.registered_nodes[node.name].groups.drawer
|
local drawerType = core.registered_nodes[node.name].groups.drawer
|
||||||
local foundVisuals = 0
|
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
|
if objs then
|
||||||
for _, obj in pairs(objs) do
|
for _, obj in pairs(objs) do
|
||||||
if obj and obj:get_luaentity() and
|
if obj and obj:get_luaentity() and
|
||||||
|
Loading…
Reference in New Issue
Block a user