diff --git a/door_wood_plain.lua b/door_wood_plain.lua index c64f013..5b38280 100644 --- a/door_wood_plain.lua +++ b/door_wood_plain.lua @@ -71,11 +71,14 @@ minetest.register_node("homedecor:door_wood_plain_bottom_left", { }, on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above + local pd = true if type(IsPlayerNodeOwner)=="function" then if not IsPlayerNodeOwner(pos, placer:get_player_name()) then minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false end - else + end + if pd then fdir = minetest.dir_to_facedir(placer:get_look_dir()) if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) @@ -84,7 +87,6 @@ minetest.register_node("homedecor:door_wood_plain_bottom_left", { minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_plain_top_left", param2=fdir}) return minetest.item_place(itemstack, placer, pointed_thing) end - end, after_dig_node = function(pos, oldnode, oldmetadata, digger) if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_wood_plain_top_left" then @@ -171,11 +173,14 @@ minetest.register_node("homedecor:door_wood_plain_bottom_right", { drop = "homedecor:door_wood_plain_bottom_left", on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.above - if type(IsPlayerNodeOwner)=="function" then + local pd = true + if type(IsPlayerNodeOwner)=="function" then if not IsPlayerNodeOwner(pos, placer:get_player_name()) then minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false end - else + end + if pd then fdir = minetest.dir_to_facedir(placer:get_look_dir()) if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) @@ -184,7 +189,6 @@ minetest.register_node("homedecor:door_wood_plain_bottom_right", { minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_plain_top_right", param2=fdir}) return minetest.item_place(itemstack, placer, pointed_thing) end - end, after_dig_node = function(pos, oldnode, oldmetadata, digger) if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_wood_plain_top_right" then