mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 18:40:25 +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", {
|
||||
description = "Young tree",
|
||||
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
|
||||
local pos = pointed_thing.under
|
||||
|
||||
@ -9,7 +9,7 @@ minetest.register_craftitem(":bushes:youngtree", {
|
||||
local m = 0
|
||||
if (y > 2) then m = 1 end
|
||||
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
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user