mirror of
https://github.com/minetest-mods/drawers.git
synced 2024-11-10 00:43:43 +01:00
Fix maple drawers (#51)
Prevent the visible entity from being deleted on the maple drawers.
This commit is contained in:
parent
d3850ca205
commit
4e2e3a02b4
@ -100,6 +100,7 @@ function drawers.spawn_visuals(pos)
|
|||||||
local pos2 = vector.add(pos, vector.multiply(fdir, 0.45))
|
local pos2 = vector.add(pos, vector.multiply(fdir, 0.45))
|
||||||
|
|
||||||
local obj = core.add_entity(pos2, "drawers:visual")
|
local obj = core.add_entity(pos2, "drawers:visual")
|
||||||
|
if not obj then return end
|
||||||
|
|
||||||
if bdir.x < 0 then obj:set_yaw(0.5 * math.pi) end
|
if bdir.x < 0 then obj:set_yaw(0.5 * math.pi) end
|
||||||
if bdir.z < 0 then obj:set_yaw(math.pi) end
|
if bdir.z < 0 then obj:set_yaw(math.pi) end
|
||||||
|
@ -78,7 +78,7 @@ core.register_entity("drawers:visual", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
local node = minetest.get_node(self.object:get_pos())
|
local node = minetest.get_node(self.object:get_pos())
|
||||||
if not node.name:match("^drawers:") then
|
if core.get_item_group(node.name, "drawer") == 0 then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -210,7 +210,8 @@ core.register_entity("drawers:visual", {
|
|||||||
|
|
||||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||||
local node = minetest.get_node(self.object:get_pos())
|
local node = minetest.get_node(self.object:get_pos())
|
||||||
if not node.name:match("^drawers:") then
|
|
||||||
|
if core.get_item_group(node.name, "drawer") == 0 then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user