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

View File

@ -47,6 +47,17 @@ local rope_ladder_top_def = {
groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2}, groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(), 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) after_place_node = function(pos, placer)
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}
local node_below = minetest.get_node(pos_below) local node_below = minetest.get_node(pos_below)

View File

@ -135,6 +135,17 @@ local function register_rope_block(multiple, max_multiple, name_prefix, node_pre
collision_box = {type="regular"}, collision_box = {type="regular"},
groups = {choppy=2, oddly_breakable_by_hand=1, rope_block = 1}, 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) after_place_node = function(pos, placer)
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}
local placer_name = placer:get_player_name() local placer_name = placer:get_player_name()