disallow rope boxes and ladders attached to walkable-false nodes

This commit is contained in:
FaceDeer 2017-04-30 11:54:39 -06:00
parent 2729d8ff6d
commit 41405085cf
2 changed files with 22 additions and 0 deletions

@ -46,6 +46,17 @@ local rope_ladder_top_def = {
},
groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then
local target_node = minetest.get_node(pointed_thing.under)
local target_def = minetest.registered_nodes[target_node.name]
if target_def.walkable == false then
return itemstack
end
end
return minetest.item_place(itemstack, placer, pointed_thing)
end,
after_place_node = function(pos, placer)
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}

@ -134,6 +134,17 @@ local function register_rope_block(multiple, max_multiple, name_prefix, node_pre
selection_box = {type="regular"},
collision_box = {type="regular"},
groups = {choppy=2, oddly_breakable_by_hand=1, rope_block = 1},
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type == "node" then
local target_node = minetest.get_node(pointed_thing.under)
local target_def = minetest.registered_nodes[target_node.name]
if target_def.walkable == false then
return itemstack
end
end
return minetest.item_place(itemstack, placer, pointed_thing)
end,
after_place_node = function(pos, placer)
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}