diff --git a/minetestforfun_game/mods/farming/beanpole.lua b/minetestforfun_game/mods/farming/beanpole.lua index 634f6bf3..a90e1840 100755 --- a/minetestforfun_game/mods/farming/beanpole.lua +++ b/minetestforfun_game/mods/farming/beanpole.lua @@ -63,18 +63,19 @@ minetest.register_node("farming:beanpole", { groups = {snappy = 3, flammable = 2, attached_node = 1}, sounds = default.node_sound_leaves_defaults(), 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 end local nod = minetest.get_node_or_nil(pointed_thing.under) if nod and minetest.get_item_group(nod.name, "soil") < 2 then return 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) if nod and nod.name ~= "air" then return end minetest.set_node(pointed_thing.above, {name = "farming:beanpole"}) diff --git a/minetestforfun_game/mods/farming/grapes.lua b/minetestforfun_game/mods/farming/grapes.lua index 93cf1d11..102d3633 100755 --- a/minetestforfun_game/mods/farming/grapes.lua +++ b/minetestforfun_game/mods/farming/grapes.lua @@ -59,18 +59,19 @@ minetest.register_node("farming:trellis", { groups = {snappy = 3, flammable = 2, attached_node = 1}, sounds = default.node_sound_leaves_defaults(), 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 end local nod = minetest.get_node_or_nil(pointed_thing.under) if nod and minetest.get_item_group(nod.name, "soil") < 2 then return 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) if nod and nod.name ~= "air" then return end minetest.set_node(pointed_thing.above, {name = "farming:trellis"}) diff --git a/mods/areas/api.lua b/mods/areas/api.lua index d6f758d9..218be92c 100755 --- a/mods/areas/api.lua +++ b/mods/areas/api.lua @@ -1,9 +1,9 @@ --plants to place in openfarming -local plants = { ["farming:blueberries"]=1, ["farming:carrot"]=1, ["farming:coffee_beans"]=1, ["farming:corn"]=1, ["farming:cucumber"]=1, - ["farming:melon_slice"]=1, ["farming:potato"]=1, ["farming:pumpkin_slice"]=1, ["farming:raspberries"]=1, ["farming:rhubarb"]=1, - ["farming:tomato"]=1, ["farming:seed_cotton"]=1, ["farming:seed_wheat"]=1,["default:papyrus"]=1, ["farming:trellis"]=1, - ["farming:grapes"]=1, ["farming:beanpole"]=1, ["farming:beans"]=1, +local plants = { ["farming:blueberries"]="air", ["farming:carrot"]="air", ["farming:coffee_beans"]="air", ["farming:corn"]="air", ["farming:cucumber"]="air", + ["farming:melon_slice"]="air", ["farming:potato"]="air", ["farming:pumpkin_slice"]="air", ["farming:raspberries"]="air", ["farming:rhubarb"]="air", + ["farming:tomato"]="air", ["farming:seed_cotton"]="air", ["farming:seed_wheat"]="air",["default:papyrus"]="air", ["farming:trellis"]="air", + ["farming:grapes"]="farming:trellis", ["farming:beanpole"]="air", ["farming:beans"]="farming:beanpole", } -- Returns a list of areas that include the provided position @@ -77,7 +77,7 @@ function areas:canInteract(pos, name) end --on_place - if node == "air" and plants[wstack] ~= nil then + if plants[wstack] ~= nil and plants[wstack] == node then return true end