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).
This commit is contained in:
Vanessa Ezekowitz 2012-10-09 05:57:24 -04:00
parent ec21a17e7d
commit a7a2e11b7e
7 changed files with 209 additions and 97 deletions

View File

@ -106,15 +106,23 @@ minetest.register_node("homedecor:door_closet_mahogany_bottom_left", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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 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, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 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", drop = "homedecor:door_closet_mahogany_bottom_left",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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 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, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_closet_mahogany_top_right" then

View File

@ -106,15 +106,23 @@ minetest.register_node("homedecor:door_closet_oak_bottom_left", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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 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, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 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", drop = "homedecor:door_closet_oak_bottom_left",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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 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, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_closet_oak_top_right" then

View File

@ -84,15 +84,23 @@ minetest.register_node("homedecor:door_exterior_fancy_bottom_left", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_left", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 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", drop = "homedecor:door_exterior_fancy_bottom_left",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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 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, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_exterior_fancy_top_right" then

View File

@ -74,15 +74,23 @@ minetest.register_node("homedecor:door_glass_bottom_left", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_glass_top_left", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 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", drop = "homedecor:door_glass_bottom_left",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_glass_top_right", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_glass_top_right" then

View File

@ -86,15 +86,23 @@ minetest.register_node("homedecor:door_wood_glass_bottom_left", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_wood_glass_top_left", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 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", drop = "homedecor:door_wood_glass_bottom_left",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_wood_glass_top_right", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_wood_glass_top_right" then

View File

@ -86,15 +86,23 @@ minetest.register_node("homedecor:door_wood_glass_mahogany_bottom_left", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_wood_glass_mahogany_top_left", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 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", drop = "homedecor:door_wood_glass_mahogany_bottom_left",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_wood_glass_mahogany_top_right", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_wood_glass_mahogany_top_right" then

View File

@ -86,15 +86,23 @@ minetest.register_node("homedecor:door_wood_glass_white_bottom_left", {
} }
}, },
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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 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) return minetest.item_place(itemstack, placer, pointed_thing)
end
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 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", drop = "homedecor:door_wood_glass_white_bottom_left",
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
fdir = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above local pos = pointed_thing.above
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then local pd = true
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place a door!' ) if type(IsPlayerNodeOwner)=="function" then
return 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_wood_glass_white_top_right", param2=fdir})
return minetest.item_place(itemstack, placer, pointed_thing)
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)
end, end,
after_dig_node = function(pos, oldnode, oldmetadata, digger) 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 if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "homedecor:door_wood_glass_white_top_right" then