summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2017-08-22 15:54:53 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2017-08-22 15:54:53 +0100
commit7479131a2c0878ddddecb7dc8ca1a36b77c43702 (patch)
treeefbf615c8485e72f319dc2125c83b71ba0c3d313
parent7e07b9af7ecfa016ed3351bb7eb1e9d1e9eead15 (diff)
tidy code
-rw-r--r--init.lua41
-rw-r--r--locale/de.txt3
-rw-r--r--locale/template.txt3
-rw-r--r--locale/tr.txt3
-rw-r--r--tool.lua13
5 files changed, 31 insertions, 32 deletions
diff --git a/init.lua b/init.lua
index f58afa3..ffdb28d 100644
--- a/init.lua
+++ b/init.lua
@@ -1,8 +1,4 @@
--- 'delprotect' priv removed, use 'protection_bypass' instead
---minetest.register_privilege("delprotect","Ignore player protection")
-
-
-- get minetest.conf settings
protector = {}
protector.mod = "redo"
@@ -46,6 +42,13 @@ protector.set_member_list = function(meta, list)
end
+-- check if name is owner
+protector.is_owner = function(meta, name)
+
+ return name == meta:get_string("owner")
+end
+
+
-- check if player name is a member
protector.is_member = function (meta, name)
@@ -63,7 +66,9 @@ end
-- add player name to table as member
protector.add_member = function(meta, name)
- if protector.is_member(meta, name) then
+ -- does name already exist?
+ if protector.is_owner(meta, name)
+ or protector.is_member(meta, name) then
return
end
@@ -100,7 +105,7 @@ protector.generate_formspec = function(meta)
.. default.gui_bg_img
.. default.gui_slots
.. "label[2.5,0;" .. S("-- Protector interface --") .. "]"
- .. "label[0,1;" .. S("PUNCH node to show protected area or USE for area check") .. "]"
+ .. "label[0,1;" .. S("PUNCH node to show protected area") .. "]"
.. "label[0,2;" .. S("Members:") .. "]"
.. "button_exit[2.5,6.2;3,0.5;close_me;" .. S("Close") .. "]"
@@ -352,7 +357,7 @@ end
-- protection node
minetest.register_node("protector:protect", {
- description = S("Protection Block"),
+ description = S("Protection Block") .. " (" .. S("USE for area check") .. ")",
drawtype = "nodebox",
tiles = {
"moreblocks_circle_stone_bricks.png",
@@ -432,13 +437,13 @@ minetest.register_craft({
-- protection logo
minetest.register_node("protector:protect2", {
- description = S("Protection Logo"),
+ description = S("Protection Logo") .. " (" .. S("USE for area check") .. ")",
tiles = {"protector_logo.png"},
wield_image = "protector_logo.png",
inventory_image = "protector_logo.png",
sounds = default.node_sound_stone_defaults(),
groups = {dig_immediate = 2, unbreakable = 1},
- paramtype = 'light',
+ paramtype = "light",
paramtype2 = "wallmounted",
legacy_wallmounted = true,
light_source = 4,
@@ -500,16 +505,20 @@ minetest.register_node("protector:protect2", {
on_blast = function() end,
})
---[[
+
+-- recipes to switch between protectors
minetest.register_craft({
+ type = "shapeless",
+ output = "protector:protect",
+ recipe = {"protector:protect2"}
+})
+
+minetest.register_craft({
+ type = "shapeless",
output = "protector:protect2",
- recipe = {
- {"default:stone", "default:stone", "default:stone"},
- {"default:stone", "default:copper_ingot", "default:stone"},
- {"default:stone", "default:stone", "default:stone"},
- }
+ recipe = {"protector:protect"}
})
-]]
+
-- check formspec buttons or when name entered
minetest.register_on_player_receive_fields(function(player, formname, fields)
diff --git a/locale/de.txt b/locale/de.txt
index 32b0222..4bdc3c4 100644
--- a/locale/de.txt
+++ b/locale/de.txt
@@ -22,7 +22,8 @@ Protected Chest (@1) = Geschützte Truhe (@1)
#init.lua
-- Protector interface -- = -- Störschutz-Interface --
-PUNCH node to show protected area or USE for area check = SCHLAGE Node, um geschützten Bereich anzuzeigen oder\nBENUTZE für Bereichsprüfung
+PUNCH node to show protected area = SCHLAGE Node, um geschützten Bereich anzuzeigen oder
+USE for area check = BENUTZE für Bereichsprüfung
Members: = Mitglieder:
Close = Schließen
This area is owned by @1! = Dieses Gebiet gehoert @1!
diff --git a/locale/template.txt b/locale/template.txt
index 0c0cdc9..bd277e4 100644
--- a/locale/template.txt
+++ b/locale/template.txt
@@ -20,7 +20,8 @@ Protected Chest (@1) =
#init.lua
-- Protector interface -- =
-PUNCH node to show protected area or USE for area check =
+PUNCH node to show protected area =
+USE for area check =
Members: =
Close =
This area is owned by @1! =
diff --git a/locale/tr.txt b/locale/tr.txt
index 3c12197..9c3629e 100644
--- a/locale/tr.txt
+++ b/locale/tr.txt
@@ -20,7 +20,8 @@ Protected Chest (@1) = Korumalı sandık (@1)
#init.lua
-- Protector interface -- =
-PUNCH node to show protected area or USE for area check = Korumalı alanı görmek için kutucuğa vurun yada alanı kontrol etmek için kullanın
+PUNCH node to show protected area = Korunan alanı göstermek için yumruk
+USE for area check = Bölge kontrolü için kullan
Members: = Üyeler
Close = Kapat
This area is owned by @1! = Burasının sahibi @1!
diff --git a/tool.lua b/tool.lua
index 653ba36..d02fc73 100644
--- a/tool.lua
+++ b/tool.lua
@@ -122,16 +122,3 @@ minetest.register_craft({
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
}
})
-
--- recipes to switch between protectors
-minetest.register_craft({
- type = "shapeless",
- output = "protector:protect",
- recipe = {"protector:protect2"}
-})
-
-minetest.register_craft({
- type = "shapeless",
- output = "protector:protect2",
- recipe = {"protector:protect"}
-})