From 2900014d0f4d776c85330cbf07c8217610aff82b Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Wed, 10 Oct 2012 23:49:39 -0400 Subject: [PATCH] Added support for glomie's node protection mod. Like the node_ownership mod, you can only place doors on land that is either not protected, or is protected by you (singleplayer mode is unaffected). --- door_closet_mahogany.lua | 12 ++++++++++++ door_exterior_fancy.lua | 12 ++++++++++++ door_glass.lua | 12 ++++++++++++ door_glass_and_wood.lua | 12 ++++++++++++ door_glass_and_wood_mahogany.lua | 12 ++++++++++++ door_glass_and_wood_white.lua | 12 ++++++++++++ door_wood_plain.lua | 12 ++++++++++++ 7 files changed, 84 insertions(+) diff --git a/door_closet_mahogany.lua b/door_closet_mahogany.lua index b819961..2a9f4cc 100644 --- a/door_closet_mahogany.lua +++ b/door_closet_mahogany.lua @@ -114,6 +114,12 @@ minetest.register_node("homedecor:door_closet_mahogany_bottom_left", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 @@ -252,6 +258,12 @@ minetest.register_node("homedecor:door_closet_mahogany_bottom_right", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 diff --git a/door_exterior_fancy.lua b/door_exterior_fancy.lua index aba1c1d..73420ec 100644 --- a/door_exterior_fancy.lua +++ b/door_exterior_fancy.lua @@ -92,6 +92,12 @@ minetest.register_node("homedecor:door_exterior_fancy_bottom_left", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 @@ -204,6 +210,12 @@ minetest.register_node("homedecor:door_exterior_fancy_bottom_right", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 diff --git a/door_glass.lua b/door_glass.lua index 1210a3e..e7d6418 100644 --- a/door_glass.lua +++ b/door_glass.lua @@ -82,6 +82,12 @@ minetest.register_node("homedecor:door_glass_bottom_left", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 @@ -188,6 +194,12 @@ minetest.register_node("homedecor:door_glass_bottom_right", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 diff --git a/door_glass_and_wood.lua b/door_glass_and_wood.lua index 9137653..9c30d8a 100644 --- a/door_glass_and_wood.lua +++ b/door_glass_and_wood.lua @@ -94,6 +94,12 @@ minetest.register_node("homedecor:door_wood_glass_bottom_left", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 @@ -212,6 +218,12 @@ minetest.register_node("homedecor:door_wood_glass_bottom_right", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 diff --git a/door_glass_and_wood_mahogany.lua b/door_glass_and_wood_mahogany.lua index ffd80e3..5e2f456 100644 --- a/door_glass_and_wood_mahogany.lua +++ b/door_glass_and_wood_mahogany.lua @@ -94,6 +94,12 @@ minetest.register_node("homedecor:door_wood_glass_mahogany_bottom_left", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 @@ -212,6 +218,12 @@ minetest.register_node("homedecor:door_wood_glass_mahogany_bottom_right", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 diff --git a/door_glass_and_wood_white.lua b/door_glass_and_wood_white.lua index 755169b..f887281 100644 --- a/door_glass_and_wood_white.lua +++ b/door_glass_and_wood_white.lua @@ -94,6 +94,12 @@ minetest.register_node("homedecor:door_wood_glass_white_bottom_left", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 @@ -212,6 +218,12 @@ minetest.register_node("homedecor:door_wood_glass_white_bottom_right", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 diff --git a/door_wood_plain.lua b/door_wood_plain.lua index 0749a63..d6485f9 100644 --- a/door_wood_plain.lua +++ b/door_wood_plain.lua @@ -78,6 +78,12 @@ minetest.register_node("homedecor:door_wood_plain_bottom_left", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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 @@ -180,6 +186,12 @@ minetest.register_node("homedecor:door_wood_plain_bottom_right", { pd = false end end + if type(isprotect)=="function" then + pd = isprotect(5, pos, placer) + if not pd then + minetest.chat_send_player( placer:get_player_name(), "Sorry, someone owns that spot." ) + 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