mirror of
https://codeberg.org/tenplus1/farming.git
synced 2024-12-26 02:30:20 +01:00
trellis and beanpole can be used in itemframes
This commit is contained in:
parent
0f8c1dd4c9
commit
bb208f8d5b
25
beanpole.lua
25
beanpole.lua
@ -97,11 +97,32 @@ minetest.register_node("farming:beanpole", {
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||
local pt = pointed_thing
|
||||
|
||||
-- check if pointing at a node
|
||||
if not pt or pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local nodename = minetest.get_node(pointed_thing.under).name
|
||||
local under = minetest.get_node(pt.under)
|
||||
|
||||
-- return if any of the nodes are not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- am I right-clicking on something that has a custom on_place set?
|
||||
-- thanks to Krock for helping with this issue :)
|
||||
local def = minetest.registered_nodes[under.name]
|
||||
if def and def.on_rightclick then
|
||||
return def.on_rightclick(pt.under, under, placer, itemstack)
|
||||
end
|
||||
|
||||
if minetest.is_protected(pt.under, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local nodename = under.name
|
||||
|
||||
if minetest.get_item_group(nodename, "soil") < 2 then
|
||||
return
|
||||
|
25
grapes.lua
25
grapes.lua
@ -92,11 +92,32 @@ minetest.register_node("farming:trellis", {
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
|
||||
local pt = pointed_thing
|
||||
|
||||
-- check if pointing at a node
|
||||
if not pt or pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local nodename = minetest.get_node(pointed_thing.under).name
|
||||
local under = minetest.get_node(pt.under)
|
||||
|
||||
-- return if any of the nodes are not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- am I right-clicking on something that has a custom on_place set?
|
||||
-- thanks to Krock for helping with this issue :)
|
||||
local def = minetest.registered_nodes[under.name]
|
||||
if def and def.on_rightclick then
|
||||
return def.on_rightclick(pt.under, under, placer, itemstack)
|
||||
end
|
||||
|
||||
if minetest.is_protected(pt.under, placer:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
local nodename = under.name
|
||||
|
||||
if minetest.get_item_group(nodename, "soil") < 2 then
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user