mirror of
https://github.com/minetest-mods/drawers.git
synced 2024-11-29 10:03:44 +01:00
Remove visual if no drawer (#28)
This commit is contained in:
parent
f5cd37cd63
commit
df4e5f7c0c
@ -163,6 +163,11 @@ core.register_entity("drawers:visual", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
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())
|
||||||
|
if not node.name:match("^drawers:") then
|
||||||
|
self.object:remove()
|
||||||
|
return
|
||||||
|
end
|
||||||
local add_stack = not puncher:get_player_control().sneak
|
local add_stack = not puncher:get_player_control().sneak
|
||||||
if core.is_protected(self.drawer_pos, puncher:get_player_name()) then
|
if core.is_protected(self.drawer_pos, puncher:get_player_name()) then
|
||||||
core.record_protection_violation(self.drawer_pos, puncher:get_player_name())
|
core.record_protection_violation(self.drawer_pos, puncher:get_player_name())
|
||||||
|
Loading…
Reference in New Issue
Block a user