mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-03-11 06:07:44 +01:00
Prevent minecarts from being placed above air nodes (#4888)
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4888 Reviewed-by: kno10 <kno10@noreply.git.minetest.land> Co-authored-by: teknomunk <teknomunk@protonmail.com> Co-committed-by: teknomunk <teknomunk@protonmail.com>
This commit is contained in:
parent
22ff4d3694
commit
73b675448e
1 changed files with 7 additions and 6 deletions
|
@ -468,12 +468,13 @@ local function register_minecart_craftitem(itemstring, def)
|
|||
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
|
||||
local called
|
||||
itemstack, called = mcl_util.handle_node_rightclick(itemstack, placer, pointed_thing)
|
||||
if called then return itemstack end
|
||||
|
||||
-- Don't place minecarts over air
|
||||
local below = core.get_node(vector.offset(pointed_thing.above,0,-1,0))
|
||||
if below.name == "air" then return itemstack end
|
||||
|
||||
return mod.place_minecart(itemstack, pointed_thing, placer)
|
||||
end,
|
||||
|
|
Loading…
Reference in a new issue