From 8fdb475a1eb5d137ebaee57de22562f5a2a081b9 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Wed, 27 May 2015 15:57:19 +0100 Subject: [PATCH] Only owner can remove protectors --- README.md | 5 +++-- init.lua | 12 ++++++++++++ 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({