mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-04-01 10:10:36 +02:00
parent
a23fc44e6d
commit
f9c045edad
@ -437,17 +437,22 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
|
|||||||
local under = minetest.get_node(pt.under)
|
local under = minetest.get_node(pt.under)
|
||||||
local above = minetest.get_node(pt.above)
|
local above = minetest.get_node(pt.above)
|
||||||
|
|
||||||
-- check if pointing at the top of the node
|
|
||||||
if pt.above.y ~= pt.under.y + 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- return if any of the nodes is not registered
|
-- return if any of the nodes is not registered
|
||||||
if not minetest.registered_nodes[under.name]
|
if not minetest.registered_nodes[under.name]
|
||||||
or not minetest.registered_nodes[above.name] then
|
or not minetest.registered_nodes[above.name] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- is there an on_rightclick callback?
|
||||||
|
if minetest.registered_nodes[under.name].on_rightclick and not placer:get_player_control().sneak then
|
||||||
|
return minetest.registered_nodes[under.name].on_rightclick(pt.under, under, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check if pointing at the top of the node
|
||||||
|
if pt.above.y ~= pt.under.y + 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- can I replace above node, and am I pointing at soil
|
-- can I replace above node, and am I pointing at soil
|
||||||
if not minetest.registered_nodes[above.name].buildable_to
|
if not minetest.registered_nodes[above.name].buildable_to
|
||||||
or minetest.get_item_group(under.name, "soil") < 2
|
or minetest.get_item_group(under.name, "soil") < 2
|
||||||
@ -472,6 +477,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
|
|||||||
)
|
)
|
||||||
end -- END refill
|
end -- END refill
|
||||||
end
|
end
|
||||||
|
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user