bucket: add a check for is_protected

This commit is contained in:
melzua 2015-11-13 20:51:45 +01:00
parent d57b5ed142
commit f323c6c379
1 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,3 @@
--
-- Crafting items
--
@ -102,6 +101,9 @@ minetest.register_craftitem(
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
if minetest.is_protected(pos_protected, user) then return end
itemstack:take_item()
local inv=user:get_inventory()
@ -135,6 +137,9 @@ minetest.register_craftitem(
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
if minetest.is_protected(pos_protected, user) then return end
itemstack:take_item()
local inv=user:get_inventory()
@ -168,6 +173,9 @@ minetest.register_craftitem(
on_place = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then return end
local pos_protected = minetest.get_pointed_thing_position(pointed_thing, true)
if minetest.is_protected(pos_protected, user) then return end
itemstack:take_item()
local inv=user:get_inventory()
@ -280,4 +288,4 @@ minetest.register_craftitem(
end,
})
default.log("craftitems", "loaded")
default.log("craftitems", "loaded")