Merge pull request #2 from Mynetest/worm_protected

Check for protection before placing a worm
This commit is contained in:
crabman77 2017-01-27 19:25:37 +01:00 committed by GitHub
commit 26f79a8f36
1 changed files with 4 additions and 2 deletions

View File

@ -17,8 +17,10 @@ minetest.register_craftitem("fishing:bait_worm", {
inventory_image = "fishing_bait_worm.png", inventory_image = "fishing_bait_worm.png",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing local pt = pointed_thing
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity") if not minetest.is_protected(pt.under, placer:get_player_name()) then
itemstack:take_item() minetest.add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity")
itemstack:take_item()
end
return itemstack return itemstack
end, end,
on_drop = function(itemstack, dropper, pos) on_drop = function(itemstack, dropper, pos)