Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Commit

Permalink
fix "Item frames won't accept green beans, bean poles, grapes, trelli…
Browse files Browse the repository at this point in the history
…s, or cocoa beans." , issue #205
  • Loading branch information
Crabman77 committed Jan 28, 2017
1 parent f432a7f commit 5099d7c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
20 changes: 13 additions & 7 deletions mods/farming/beanpole.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ minetest.register_craftitem("farming:beans", {
minetest.set_node(pointed_thing.under, {name = "farming:beanpole_1"})

minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0})
elseif minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then
return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing)
else
return
end
Expand Down Expand Up @@ -77,23 +79,27 @@ minetest.register_node("farming:beanpole", {
sounds = default.node_sound_leaves_defaults(),

on_place = function(itemstack, placer, pointed_thing)
local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}

if minetest.is_protected(pointed_thing.under, placer:get_player_name()) then
if minetest.is_protected(pointed_thing.above, placer:get_player_name())
or minetest.is_protected(top, placer:get_player_name()) then -- MFF crabman(18/06/2015)
return
end

local nodename = minetest.get_node(pointed_thing.under).name

if minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then
return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing)
end

if minetest.get_item_group(nodename, "soil") < 2 then
return
end

local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}

nodename = minetest.get_node(top).name

if nodename ~= "air" then
Expand Down
4 changes: 3 additions & 1 deletion mods/farming/cocoa.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
if not minetest.registered_nodes[under.name] then
return
end

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 jungletree
if under.name ~= "default:jungletree"
or minetest.get_node(pt.above).name ~= "air" then
Expand Down
21 changes: 13 additions & 8 deletions mods/farming/grapes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ minetest.register_craftitem("farming:grapes", {
minetest.set_node(pointed_thing.under, {name = "farming:grapes_1"})

minetest.sound_play("default_place_node", {pos = pointed_thing.above, gain = 1.0})
elseif minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then
return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing)
else
return
end
Expand Down Expand Up @@ -72,23 +74,26 @@ minetest.register_node("farming:trellis", {
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 -- MFF crabman(18/06/2015)
return
end

local nodename = minetest.get_node(pointed_thing.under).name

if minetest.registered_nodes[nodename] and minetest.registered_nodes[nodename].on_rightclick and not placer:get_player_control().sneak then
return minetest.registered_nodes[nodename].on_rightclick(pointed_thing.under, minetest.get_node(pointed_thing.under), placer, itemstack, pointed_thing)
end

if minetest.get_item_group(nodename, "soil") < 2 then
return
end

local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}

nodename = minetest.get_node(top).name

if nodename ~= "air" then
Expand Down

0 comments on commit 5099d7c

Please sign in to comment.