mirror of
https://codeberg.org/tenplus1/farming.git
synced 2024-12-26 18:50:20 +01:00
grapes, trellis, beans and beanpole has protection checks added
This commit is contained in:
parent
5345e6fdc5
commit
2d55fb613b
@ -9,6 +9,9 @@ minetest.register_craftitem("farming:beans", {
|
|||||||
inventory_image = "farming_beans.png",
|
inventory_image = "farming_beans.png",
|
||||||
on_use = minetest.item_eat(1),
|
on_use = minetest.item_eat(1),
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
||||||
if nod and nod.name == "farming:beanpole" then
|
if nod and nod.name == "farming:beanpole" then
|
||||||
minetest.set_node(pointed_thing.under, {name="farming:beanpole_1"})
|
minetest.set_node(pointed_thing.under, {name="farming:beanpole_1"})
|
||||||
@ -63,6 +66,9 @@ minetest.register_node("farming:beanpole", {
|
|||||||
},
|
},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
||||||
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
|
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
|
||||||
return
|
return
|
||||||
|
@ -5,6 +5,9 @@ minetest.register_craftitem("farming:grapes", {
|
|||||||
inventory_image = "farming_grapes.png",
|
inventory_image = "farming_grapes.png",
|
||||||
on_use = minetest.item_eat(2),
|
on_use = minetest.item_eat(2),
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
||||||
if nod and nod.name == "farming:trellis" then
|
if nod and nod.name == "farming:trellis" then
|
||||||
minetest.set_node(pointed_thing.under, {name="farming:grapes_1"})
|
minetest.set_node(pointed_thing.under, {name="farming:grapes_1"})
|
||||||
@ -59,6 +62,9 @@ minetest.register_node("farming:trellis", {
|
|||||||
},
|
},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
local nod = minetest.get_node_or_nil(pointed_thing.under)
|
||||||
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
|
if nod and minetest.get_item_group(nod.name, "soil") < 2 then
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user