From a7a2e11b7ecc87037b43de537c3a40b14ebe846f Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Tue, 9 Oct 2012 05:57:24 -0400 Subject: [PATCH] All doors now check for the presence of node_ownership and, if present and the area you place in is owned by someone else, and you don't have rights to build there, the door will not be placed (you will receive a warning message instead). --- door_closet_mahogany.lua | 44 ++++++++++++++++++++++---------- door_closet_oak.lua | 44 ++++++++++++++++++++++---------- door_exterior_fancy.lua | 44 ++++++++++++++++++++++---------- door_glass.lua | 44 ++++++++++++++++++++++---------- door_glass_and_wood.lua | 44 ++++++++++++++++++++++---------- door_glass_and_wood_mahogany.lua | 44 ++++++++++++++++++++++---------- door_glass_and_wood_white.lua | 42 ++++++++++++++++++++---------- 7 files changed, 209 insertions(+), 97 deletions(-) diff --git a/door_closet_mahogany.lua b/door_closet_mahogany.lua index cc3332c9..b819961f 100644 --- a/door_closet_mahogany.lua +++ b/door_closet_mahogany.lua @@ -106,15 +106,23 @@ minetest.register_node("homedecor:door_closet_mahogany_bottom_left", { } }, on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_mahogany_top_left", param2=fdir}) + return minetest.item_place(itemstack, placer, pointed_thing) end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_mahogany_top_left", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - 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_closet_mahogany_top_left" then @@ -236,15 +244,23 @@ minetest.register_node("homedecor:door_closet_mahogany_bottom_right", { }, drop = "homedecor:door_closet_mahogany_bottom_left", on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_mahogany_top_right", param2=fdir}) + return minetest.item_place(itemstack, placer, pointed_thing) end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_mahogany_top_right", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - 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_closet_mahogany_top_right" then diff --git a/door_closet_oak.lua b/door_closet_oak.lua index 8e108ef0..17100b97 100644 --- a/door_closet_oak.lua +++ b/door_closet_oak.lua @@ -106,15 +106,23 @@ minetest.register_node("homedecor:door_closet_oak_bottom_left", { } }, on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_oak_top_left", param2=fdir}) + return minetest.item_place(itemstack, placer, pointed_thing) end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_oak_top_left", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - 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_closet_oak_top_left" then @@ -236,15 +244,23 @@ minetest.register_node("homedecor:door_closet_oak_bottom_right", { }, drop = "homedecor:door_closet_oak_bottom_left", on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_oak_top_right", param2=fdir}) + return minetest.item_place(itemstack, placer, pointed_thing) end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_closet_oak_top_right", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - 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_closet_oak_top_right" then diff --git a/door_exterior_fancy.lua b/door_exterior_fancy.lua index 039c8141..aba1c1d7 100644 --- a/door_exterior_fancy.lua +++ b/door_exterior_fancy.lua @@ -84,15 +84,23 @@ minetest.register_node("homedecor:door_exterior_fancy_bottom_left", { } }, on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_exterior_fancy_top_left", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_exterior_fancy_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_exterior_fancy_top_left" then @@ -188,15 +196,23 @@ minetest.register_node("homedecor:door_exterior_fancy_bottom_right", { }, drop = "homedecor:door_exterior_fancy_bottom_left", on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_exterior_fancy_top_right", param2=fdir}) + return minetest.item_place(itemstack, placer, pointed_thing) end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_exterior_fancy_top_right", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - 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_exterior_fancy_top_right" then diff --git a/door_glass.lua b/door_glass.lua index ac5e877a..1210a3ee 100644 --- a/door_glass.lua +++ b/door_glass.lua @@ -74,15 +74,23 @@ minetest.register_node("homedecor:door_glass_bottom_left", { } }, on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_glass_top_left", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_glass_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_glass_top_left" then @@ -172,15 +180,23 @@ minetest.register_node("homedecor:door_glass_bottom_right", { }, drop = "homedecor:door_glass_bottom_left", on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_glass_top_right", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_glass_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_glass_top_right" then diff --git a/door_glass_and_wood.lua b/door_glass_and_wood.lua index de845cd0..91376539 100644 --- a/door_glass_and_wood.lua +++ b/door_glass_and_wood.lua @@ -86,15 +86,23 @@ minetest.register_node("homedecor:door_wood_glass_bottom_left", { } }, on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_top_left", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_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_glass_top_left" then @@ -196,15 +204,23 @@ minetest.register_node("homedecor:door_wood_glass_bottom_right", { }, drop = "homedecor:door_wood_glass_bottom_left", on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_top_right", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_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_glass_top_right" then diff --git a/door_glass_and_wood_mahogany.lua b/door_glass_and_wood_mahogany.lua index 851a5984..ffd80e3f 100644 --- a/door_glass_and_wood_mahogany.lua +++ b/door_glass_and_wood_mahogany.lua @@ -86,15 +86,23 @@ minetest.register_node("homedecor:door_wood_glass_mahogany_bottom_left", { } }, on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_mahogany_top_left", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_mahogany_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_glass_mahogany_top_left" then @@ -196,15 +204,23 @@ minetest.register_node("homedecor:door_wood_glass_mahogany_bottom_right", { }, drop = "homedecor:door_wood_glass_mahogany_bottom_left", on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_mahogany_top_right", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_mahogany_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_glass_mahogany_top_right" then diff --git a/door_glass_and_wood_white.lua b/door_glass_and_wood_white.lua index 7d666408..755169ba 100644 --- a/door_glass_and_wood_white.lua +++ b/door_glass_and_wood_white.lua @@ -86,15 +86,23 @@ minetest.register_node("homedecor:door_wood_glass_white_bottom_left", { } }, on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_white_top_left", param2=fdir}) + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_white_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_glass_white_top_left" then @@ -196,15 +204,23 @@ minetest.register_node("homedecor:door_wood_glass_white_bottom_right", { }, drop = "homedecor:door_wood_glass_white_bottom_left", on_place = function(itemstack, placer, pointed_thing) - fdir = minetest.dir_to_facedir(placer:get_look_dir()) local pos = pointed_thing.above - 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!' ) - return + local pd = true + if type(IsPlayerNodeOwner)=="function" then + if not IsPlayerNodeOwner(pos, placer:get_player_name()) and HasOwner(pos) then + minetest.chat_send_player( placer:get_player_name(), "Sorry, "..getLastOwner(pos).." owns that spot." ) + pd = false + end end - minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_white_top_right", param2=fdir}) - return minetest.item_place(itemstack, placer, pointed_thing) - + 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!' ) + return + end + minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, { name = "homedecor:door_wood_glass_white_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_glass_white_top_right" then