Only owner can remove protectors

master
tenplus1 2015-05-27 15:57:19 +01:00
parent e98bc4bd6e
commit 8fdb475a1e
2 changed files with 15 additions and 2 deletions

View File

@ -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
0.9 - Tweaked code
1.0 - Only owner can remove protector

View File

@ -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({