enderdragon egg: check for protection on punch

This commit is contained in:
AFCMS 2022-04-21 21:02:43 +02:00
parent 231b658c3f
commit 8396dfe7e3
Signed by untrusted user: AFCMS
GPG Key ID: 8720389A25B652E3
1 changed files with 11 additions and 9 deletions

View File

@ -170,7 +170,8 @@ minetest.register_node("mcl_end:dragon_egg", {
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
_mcl_blast_resistance = 9, _mcl_blast_resistance = 9,
_mcl_hardness = 3, _mcl_hardness = 3,
on_punch = function(pos, node) on_punch = function(pos, node, puncher)
if not minetest.is_protected(pos, puncher:get_player_name()) then
local max_dist = vector.new(15, 7, 15) local max_dist = vector.new(15, 7, 15)
local positions = minetest.find_nodes_in_area(vector.subtract(pos, max_dist), vector.add(pos, max_dist), "air", false) local positions = minetest.find_nodes_in_area(vector.subtract(pos, max_dist), vector.add(pos, max_dist), "air", false)
if #positions > 0 then if #positions > 0 then
@ -179,6 +180,7 @@ minetest.register_node("mcl_end:dragon_egg", {
minetest.set_node(tpos, node) minetest.set_node(tpos, node)
minetest.check_for_falling(tpos) minetest.check_for_falling(tpos)
end end
end
end, end,
}) })