Only owner and delprotect privelaged can remove protectors
authortenplus1 <kinsellaja@yahoo.com>
Wed, 27 May 2015 17:15:04 +0000 (18:15 +0100)
committertenplus1 <kinsellaja@yahoo.com>
Wed, 27 May 2015 17:15:04 +0000 (18:15 +0100)
init.lua

index 1b50804..2f20334 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -58,7 +58,7 @@ protector.generate_formspec = function(meta)
                                formspec = formspec .. "button["..(i%4*2+1.25)..","
                                ..math.floor(i/4+3)..";.75,.5;protector_del_member_"..member..";X]"
                        end
-                       i = i +1
+                       i = i + 1
        end
        
        if i < npp then
@@ -216,9 +216,7 @@ minetest.register_node("protector:protect", {
        end,
 
        can_dig = function(pos, player)
-               local meta = minetest.get_meta(pos)
-               local inv = meta:get_inventory()
-               return (meta:get_string("owner") == player:get_player_name())
+               return protector.can_dig(1,pos,player:get_player_name(),true,1)
        end,
 })
 
@@ -282,9 +280,7 @@ minetest.register_node("protector:protect2", {
        end,
 
        can_dig = function(pos, player)
-               local meta = minetest.get_meta(pos)
-               local inv = meta:get_inventory()
-               return (meta:get_string("owner") == player:get_player_name())
+               return protector.can_dig(1,pos,player:get_player_name(),true,1)
        end,
 })