From 5f20b18d326577df40dd4a7c6ba6da7ea9309184 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 1 Mar 2017 15:32:51 +0100 Subject: [PATCH] Disallow to place ladders on some other nodes --- mods/ITEMS/mcl_core/nodes.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes.lua b/mods/ITEMS/mcl_core/nodes.lua index 6bda34f55..bb515a875 100644 --- a/mods/ITEMS/mcl_core/nodes.lua +++ b/mods/ITEMS/mcl_core/nodes.lua @@ -1171,11 +1171,19 @@ minetest.register_node("mcl_core:ladder", { local under = pointed_thing.under local node = minetest.get_node(under) - local def = minetest.registered_nodes[node.name] + local groups = def.groups + if (groups and (groups.glass or groups.leaves or groups.slab)) or + node.name == "mcl_core:ice" or node.name == "mcl_nether:glowstone" or node.name == "mcl_ocean:sea_lantern" then + return itemstack + end + + -- Check special rightclick action of pointed node if def and def.on_rightclick then - return def.on_rightclick(under, node, placer, itemstack, - pointed_thing) or itemstack, false + if not placer:get_player_control().sneak then + return def.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack, false + end end local above = pointed_thing.above