forked from Mineclonia/Mineclonia
Make more items respect the node's on_rightclick
- Bone meal - Fishing rod - Seeds - Hopper - Nether wart - Sponge - Bow - Shovel
This commit is contained in:
parent
064bf1effe
commit
9cb2f5b392
|
@ -217,6 +217,15 @@ minetest.register_craftitem("mcl_dye:white", {
|
|||
stack_max = 64,
|
||||
groups = dyelocal.dyes[1][3],
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if user and not user:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
-- Use the bone meal on the ground
|
||||
if(mcl_dye.apply_bone_meal(pointed_thing) and not minetest.setting_getbool("creative_mode")) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
|
|
@ -47,6 +47,14 @@ function mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname)
|
|||
return
|
||||
end
|
||||
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pt.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pt.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
local pos = {x=pt.above.x, y=pt.above.y-1, z=pt.above.z}
|
||||
local farmland = minetest.get_node(pos)
|
||||
pos= {x=pt.above.x, y=pt.above.y, z=pt.above.z}
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
local go_fishing = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing and pointed_thing.under then
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if user and not user:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
if string.find(node.name, "mcl_core:water") then
|
||||
local itemname
|
||||
local itemcount = 1
|
||||
|
|
|
@ -48,8 +48,17 @@ minetest.register_node("mcl_hoppers:hopper", {
|
|||
local upos = pointed_thing.under
|
||||
local apos = pointed_thing.above
|
||||
|
||||
local uposnode = minetest.get_node(upos)
|
||||
local uposnodedef = minetest.registered_nodes[uposnode.name]
|
||||
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if uposnodedef and uposnodedef.on_rightclick then
|
||||
return uposnodedef.on_rightclick(pointed_thing.under, uposnode, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
local bpos
|
||||
local uposnodedef = minetest.registered_nodes[minetest.get_node(upos).name]
|
||||
if uposnodedef.buildable_to then
|
||||
bpos = upos
|
||||
else
|
||||
|
|
|
@ -74,13 +74,22 @@ minetest.register_node("mcl_nether:nether_wart", {
|
|||
})
|
||||
|
||||
minetest.register_craftitem("mcl_nether:nether_wart_item", {
|
||||
description = "Nether Wart",
|
||||
descripointed_thingption = "Nether Wart",
|
||||
inventory_image = "mcl_nether_nether_wart.png",
|
||||
wield_image = "mcl_nether_nether_wart.png",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
local placepos = pointed_thing.above
|
||||
local soilpos = table.copy(placepos)
|
||||
soilpos.y = soilpos.y - 1
|
||||
|
|
|
@ -16,6 +16,15 @@ minetest.register_node("mcl_sponges:sponge", {
|
|||
if pointed_thing.type ~= "node" then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.is_protected(pointed_thing.above, pn) then
|
||||
return itemstack
|
||||
end
|
||||
|
|
|
@ -72,6 +72,16 @@ end
|
|||
|
||||
local powerup_function = function(nextbow)
|
||||
return function(itemstack, placer, pointed_thing)
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
if pointed_thing.type == "node" then
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if get_arrow(placer) ~= nil then
|
||||
local wear = itemstack:get_wear()
|
||||
itemstack:replace(nextbow)
|
||||
|
|
|
@ -142,7 +142,15 @@ local get_shovel_dig_group = function(itemstring)
|
|||
end
|
||||
|
||||
local make_grass_path = function(itemstack, placer, pointed_thing)
|
||||
if minetest.get_node(pointed_thing.under).name == "mcl_tools:dirt_with_grass" and pointed_thing.above.y == pointed_thing.under.y then
|
||||
-- Use pointed node's on_rightclick function first, if present
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if placer and not placer:get_player_control().sneak then
|
||||
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
||||
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.get_node(node).name == "mcl_tools:dirt_with_grass" and pointed_thing.above.y == pointed_thing.under.y then
|
||||
local above = table.copy(pointed_thing.under)
|
||||
above.y = above.y + 1
|
||||
if minetest.get_node(above).name == "air" then
|
||||
|
|
Loading…
Reference in New Issue