summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortenplus1 <kinsellaja@yahoo.com>2015-05-27 15:57:19 +0100
committertenplus1 <kinsellaja@yahoo.com>2015-05-27 15:57:19 +0100
commit8fdb475a1eb5d137ebaee57de22562f5a2a081b9 (patch)
tree246a20f70371241376e88b24779e1ff6b24ee613
parente98bc4bd6ed9b246bddbe43a25c0979e87d7385b (diff)
Only owner can remove protectors
-rw-r--r--README.md5
-rw-r--r--init.lua12
2 files changed, 15 insertions, 2 deletions
diff --git a/README.md b/README.md
index 5e62e54..7360dfa 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
Protector Redo mod [protect]
-Protector redo mod for minetest is based on glomie's mod, remade by Zeg9 and reworked by TenPlus1 to support minetest 0.4.9 and include protected doors and chests
+Protector redo mod for minetest is based on glomie's mod, remade by Zeg9 and reworked by TenPlus1.
https://forum.minetest.net/viewtopic.php?f=11&t=9376
@@ -14,4 +14,5 @@ Released under WTFPL
0.6 - Added Protected Doors (wood and steel) and Protected Chest
0.7 - Protected Chests now have "To Chest" and "To Inventory" buttons to copy contents across, also chests can be named
0.8 - Updated to work with Minetest 0.4.12, simplified textures
-0.9 - Tweaked code \ No newline at end of file
+0.9 - Tweaked code
+1.0 - Only owner can remove protector \ No newline at end of file
diff --git a/init.lua b/init.lua
index f2cba68..1b50804 100644
--- a/init.lua
+++ b/init.lua
@@ -214,6 +214,12 @@ minetest.register_node("protector:protect", {
end
minetest.add_entity(pos, "protector:display")
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())
+ end,
})
minetest.register_craft({
@@ -274,6 +280,12 @@ minetest.register_node("protector:protect2", {
end
minetest.add_entity(pos, "protector:display")
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())
+ end,
})
minetest.register_craft({