Allow changing screwdriver mode when pointing at a protected node

This commit is contained in:
ShadowNinja 2013-12-22 17:16:31 -05:00
parent 4ea001fa37
commit 5dcc5cb305

@ -60,16 +60,16 @@ local function screwdriver_handler(itemstack, user, pointed_thing)
return return
end end
local pos = pointed_thing.under local pos = pointed_thing.under
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return
end
local keys = user:get_player_control() local keys = user:get_player_control()
local player_name = user:get_player_name() local player_name = user:get_player_name()
local mode = tonumber(itemstack:get_metadata()) local mode = tonumber(itemstack:get_metadata())
if not mode or keys["sneak"] == true then if not mode or keys["sneak"] == true then
return screwdriver_setmode(user, itemstack) return screwdriver_setmode(user, itemstack)
end end
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return
end
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local node_name = node.name local node_name = node.name
local ndef = minetest.registered_nodes[node.name] local ndef = minetest.registered_nodes[node.name]