mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-26 01:30:29 +01:00
[_misc] Check protection when spawning young trees
This commit is contained in:
parent
9cce34f4d8
commit
bf5c90d116
@ -1,7 +1,7 @@
|
|||||||
minetest.register_craftitem(":bushes:youngtree", {
|
minetest.register_craftitem(":bushes:youngtree", {
|
||||||
description = "Young tree",
|
description = "Young tree",
|
||||||
inventory_image = "bushes_youngtree.png",
|
inventory_image = "bushes_youngtree.png",
|
||||||
on_use = function(stack, _, pointed_thing)
|
on_use = function(stack, user, pointed_thing)
|
||||||
if pointed_thing.type ~= "node" then return end
|
if pointed_thing.type ~= "node" then return end
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ minetest.register_craftitem(":bushes:youngtree", {
|
|||||||
local m = 0
|
local m = 0
|
||||||
if (y > 2) then m = 1 end
|
if (y > 2) then m = 1 end
|
||||||
for z = 0, m do
|
for z = 0, m do
|
||||||
if minetest.get_node({x = pos.x, y = pos.y+y, z = pos.z+z}).name ~= "air" then
|
if minetest.get_node({x = pos.x, y = pos.y+y, z = pos.z+z}).name ~= "air" or minetest.is_protected({x = pos.x, y = pos.y+y, z = pos.z+z}, user:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user