mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-04-01 10:10:36 +02:00
place farming:trellis, farming:beanpole in area openfarming and improve fix farming:trellis/farming:beanpole check if protected
This commit is contained in:
parent
0f40f11030
commit
cd118a669d
@ -63,18 +63,19 @@ minetest.register_node("farming:beanpole", {
|
|||||||
groups = {snappy = 3, flammable = 2, attached_node = 1},
|
groups = {snappy = 3, flammable = 2, attached_node = 1},
|
||||||
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
|
local top = {
|
||||||
|
x = pointed_thing.above.x,
|
||||||
|
y = pointed_thing.above.y + 1,
|
||||||
|
z = pointed_thing.above.z
|
||||||
|
}
|
||||||
|
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) or minetest.is_protected(top, placer:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
local top = {
|
|
||||||
x = pointed_thing.above.x,
|
|
||||||
y = pointed_thing.above.y + 1,
|
|
||||||
z = pointed_thing.above.z
|
|
||||||
}
|
|
||||||
nod = minetest.get_node_or_nil(top)
|
nod = minetest.get_node_or_nil(top)
|
||||||
if nod and nod.name ~= "air" then return end
|
if nod and nod.name ~= "air" then return end
|
||||||
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
|
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
|
||||||
|
@ -59,18 +59,19 @@ minetest.register_node("farming:trellis", {
|
|||||||
groups = {snappy = 3, flammable = 2, attached_node = 1},
|
groups = {snappy = 3, flammable = 2, attached_node = 1},
|
||||||
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
|
local top = {
|
||||||
|
x = pointed_thing.above.x,
|
||||||
|
y = pointed_thing.above.y + 1,
|
||||||
|
z = pointed_thing.above.z
|
||||||
|
}
|
||||||
|
if minetest.is_protected(pointed_thing.above, placer:get_player_name()) or minetest.is_protected(top, placer:get_player_name()) then
|
||||||
return
|
return
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
local top = {
|
|
||||||
x = pointed_thing.above.x,
|
|
||||||
y = pointed_thing.above.y + 1,
|
|
||||||
z = pointed_thing.above.z
|
|
||||||
}
|
|
||||||
nod = minetest.get_node_or_nil(top)
|
nod = minetest.get_node_or_nil(top)
|
||||||
if nod and nod.name ~= "air" then return end
|
if nod and nod.name ~= "air" then return end
|
||||||
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
|
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
--plants to place in openfarming
|
--plants to place in openfarming
|
||||||
local plants = { ["farming:blueberries"]=1, ["farming:carrot"]=1, ["farming:coffee_beans"]=1, ["farming:corn"]=1, ["farming:cucumber"]=1,
|
local plants = { ["farming:blueberries"]="air", ["farming:carrot"]="air", ["farming:coffee_beans"]="air", ["farming:corn"]="air", ["farming:cucumber"]="air",
|
||||||
["farming:melon_slice"]=1, ["farming:potato"]=1, ["farming:pumpkin_slice"]=1, ["farming:raspberries"]=1, ["farming:rhubarb"]=1,
|
["farming:melon_slice"]="air", ["farming:potato"]="air", ["farming:pumpkin_slice"]="air", ["farming:raspberries"]="air", ["farming:rhubarb"]="air",
|
||||||
["farming:tomato"]=1, ["farming:seed_cotton"]=1, ["farming:seed_wheat"]=1,["default:papyrus"]=1, ["farming:trellis"]=1,
|
["farming:tomato"]="air", ["farming:seed_cotton"]="air", ["farming:seed_wheat"]="air",["default:papyrus"]="air", ["farming:trellis"]="air",
|
||||||
["farming:grapes"]=1, ["farming:beanpole"]=1, ["farming:beans"]=1,
|
["farming:grapes"]="farming:trellis", ["farming:beanpole"]="air", ["farming:beans"]="farming:beanpole",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Returns a list of areas that include the provided position
|
-- Returns a list of areas that include the provided position
|
||||||
@ -77,7 +77,7 @@ function areas:canInteract(pos, name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--on_place
|
--on_place
|
||||||
if node == "air" and plants[wstack] ~= nil then
|
if plants[wstack] ~= nil and plants[wstack] == node then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user