mirror of
https://github.com/minetest-mods/drawers.git
synced 2024-11-26 00:23:44 +01:00
Add support for protections (#10)
This commit is contained in:
parent
8209b58b9a
commit
f6a89e19bf
@ -147,6 +147,10 @@ core.register_entity("drawers:visual", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
|
if core.is_protected(self.drawer_pos, clicker:get_player_name()) then
|
||||||
|
core.record_protection_violation(self.drawer_pos, clicker:get_player_name())
|
||||||
|
return
|
||||||
|
end
|
||||||
local leftover = self.try_insert_stack(self, clicker:get_wielded_item(),
|
local leftover = self.try_insert_stack(self, clicker:get_wielded_item(),
|
||||||
not clicker:get_player_control().sneak)
|
not clicker:get_player_control().sneak)
|
||||||
|
|
||||||
@ -160,7 +164,10 @@ 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 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
|
||||||
|
core.record_protection_violation(self.drawer_pos, puncher:get_player_name())
|
||||||
|
return
|
||||||
|
end
|
||||||
local inv = puncher:get_inventory()
|
local inv = puncher:get_inventory()
|
||||||
local spaceChecker = ItemStack(self.itemName)
|
local spaceChecker = ItemStack(self.itemName)
|
||||||
if add_stack then
|
if add_stack then
|
||||||
|
Loading…
Reference in New Issue
Block a user