mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-26 03:07:32 +01:00
Spawn egg, boat, cart, book use node rightclick
This commit is contained in:
parent
711ec5f38c
commit
b68224a38d
@ -2821,6 +2821,14 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
|||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
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 pos = pointed_thing.above
|
local pos = pointed_thing.above
|
||||||
|
|
||||||
if pos
|
if pos
|
||||||
|
@ -152,6 +152,15 @@ for w=1, #woods do
|
|||||||
if pointed_thing.type ~= "node" then
|
if pointed_thing.type ~= "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
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 not is_water(pointed_thing.under) then
|
if not is_water(pointed_thing.under) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -13,6 +13,16 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
local write = function(itemstack, user, pointed_thing)
|
local write = function(itemstack, user, pointed_thing)
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
if pointed_thing.type == "node" then
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
local text = itemstack:get_metadata()
|
local text = itemstack:get_metadata()
|
||||||
local formspec = "size[8,9]"..
|
local formspec = "size[8,9]"..
|
||||||
"background[-0.5,-0.5;9,10;mcl_books_book_bg.png]"..
|
"background[-0.5,-0.5;9,10;mcl_books_book_bg.png]"..
|
||||||
@ -23,6 +33,16 @@ local write = function(itemstack, user, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local read = function(itemstack, user, pointed_thing)
|
local read = function(itemstack, user, pointed_thing)
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
if pointed_thing.type == "node" then
|
||||||
|
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
|
||||||
|
end
|
||||||
|
|
||||||
local meta = minetest.deserialize(itemstack:get_metadata())
|
local meta = minetest.deserialize(itemstack:get_metadata())
|
||||||
local text
|
local text
|
||||||
if meta ~= nil then
|
if meta ~= nil then
|
||||||
|
@ -267,6 +267,15 @@ minetest.register_craftitem("mcl_minecarts:minecart", {
|
|||||||
if not pointed_thing.type == "node" then
|
if not pointed_thing.type == "node" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Call on_rightclick if the pointed node defines it
|
||||||
|
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 mcl_minecarts:is_rail(pointed_thing.under) then
|
if mcl_minecarts:is_rail(pointed_thing.under) then
|
||||||
minetest.add_entity(pointed_thing.under, "mcl_minecarts:minecart")
|
minetest.add_entity(pointed_thing.under, "mcl_minecarts:minecart")
|
||||||
elseif mcl_minecarts:is_rail(pointed_thing.above) then
|
elseif mcl_minecarts:is_rail(pointed_thing.above) then
|
||||||
|
Loading…
Reference in New Issue
Block a user