This commit is contained in:
Muhammad Nur Hidayat Yasuyoshi (MNH48.com) 2018-02-16 18:21:27 +00:00 committed by GitHub
commit 644bc397d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 1954 additions and 197 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*~
*.swp

114
api.lua
View File

@ -14,6 +14,13 @@ function areas:getExternalHudEntries(pos)
return areas
end
--plants to place in openfarming
local plants = { ["farming:blueberries"]="air", ["farming:carrot"]="air", ["farming:coffee_beans"]="air", ["farming:corn"]="air", ["farming:cucumber"]="air",
["farming:melon_slice"]="air", ["farming:potato"]="air", ["farming:pumpkin_slice"]="air", ["farming:raspberries"]="air", ["farming:rhubarb"]="air",
["farming:tomato"]="air", ["farming:seed_cotton"]="air", ["farming:seed_wheat"]="air",["default:papyrus"]="air", ["farming:trellis"]="air",
["farming:grapes"]="farming:trellis", ["farming:beanpole"]="air", ["farming:beans"]="farming:beanpole",
}
--- Returns a list of areas that include the provided position.
function areas:getAreasAtPos(pos)
local res = {}
@ -29,9 +36,9 @@ function areas:getAreasAtPos(pos)
for id, area in pairs(self.areas) do
local ap1, ap2 = area.pos1, area.pos2
if
(px >= ap1.x and px <= ap2.x) and
(py >= ap1.y and py <= ap2.y) and
(pz >= ap1.z and pz <= ap2.z) then
(px >= ap1.x and px <= ap2.x) and
(py >= ap1.y and py <= ap2.y) and
(pz >= ap1.z and pz <= ap2.z) then
res[id] = area
end
end
@ -73,9 +80,42 @@ function areas:canInteract(pos, name)
return true
end
local owned = false
-- to avoid crash with water lily
if pos == nil then
return not owned
end
for _, area in pairs(self:getAreasAtPos(pos)) do
if area.owner == name or area.open then
return true
elseif area.openfarming then
-- if area is openfarming
local node = minetest.get_node(pos).name
if not minetest.registered_nodes[node] then
return false
end
local player = minetest.get_player_by_name(name)
if not player then
return false
end
local wstack = player:get_wielded_item():get_name()
if wstack == "" then
wstack = "hand"
end
--on_dig
if minetest.get_item_group(node, "plant") == 1 and (wstack == "hand" or minetest.registered_tools[wstack]) then
return true
end
--on_place
if plants[wstack] ~= nil and plants[wstack] == node then
return true
end
owned = true
else
owned = true
end
@ -83,6 +123,74 @@ function areas:canInteract(pos, name)
return not owned
end
function areas:canMakeArea(pos1, pos2, name) --MFF crabman(25/02/2016) fix areas in areas
if name and minetest.check_player_privs(name, self.adminPrivs) then
return true
end
areas:sortPos(pos1, pos2)
local id_areas_intersect = {}
local areas = self:getAreasIntersectingArea(pos1, pos2)
if not areas then return true end
for id, area in pairs(areas) do
if area.owner == name and self:isSubarea(pos1, pos2, id) then
return true
end
if not area.open and not self:isAreaOwner(id, name) then
table.insert(id_areas_intersect, id)
end
end
if #id_areas_intersect > 0 then
return false, id_areas_intersect[1]
end
return true
end
--MFF crabman(5/03/2016 ) return special area pos if a spawn is set.
--1 party (2 party in beds mod)
function areas:getSpawn(pos)
for _, area in pairs(areas:getAreasAtPos(pos)) do
if area.spawn and area.spawn.x then
return area.spawn
end
end
return nil
end
--MFF DEBUT crabman(17/09/2015 ) respawn player in special area(event) if a spawn is set.
--1 party (2 party in beds mod)
local dead_players = {}
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
if not player_name then return end
local pos = player:getpos()
if pos then
dead_players[player_name] = pos
end
end)
function areas:onRespawn(player)
local player_name = player:get_player_name()
if not player_name or not dead_players[player_name] then return false end
local pos = dead_players[player_name]
dead_players[player_name] = nil
if pos then
for _, area in pairs(areas:getAreasAtPos(pos)) do
if area.spawn then
player:setpos(area.spawn)
return true
end
end
end
return false
end
-- Returns a table (list) of all players that own an area
function areas:getNodeOwners(pos)
local owners = {}

47
api.md
View File

@ -1,3 +1,50 @@
# API Extension
Adding your protections to the HUD
----------------------------------
If you are providing an extra protection mod to work in conjunction with the
HUD feature of `areas`, you can register a callback to add your mod's code to
display your protection's existence.
Registering a handler:
* `areas.registerHudHandler(handler) --> nil`
Handler specification:
* `handler(pos,area_list) --> new_area_list`
* `pos` - the position at which to check for protection coverage by your mod
* `area_list` - the current list of protected areas
* `new_area_list` - the list of protected areas, updated with your entries
Area list items:
The area list item is a map table identified with an ID, and properties
The ID should be in the format `modname:` and appended with an identifier for the protection.
Each area list item should be a table with the following properties
* `owner` - (required) the name of the protection owner
* `name` - (optional) the name of the area
Example
-------
local myhandler = function(pos,area_list)
local areaowner = find_my_protections(pos)
if areaowner then
arealist["mymodname:first"] = {
name = "Protection name",
owner = areaowner,
}
end
end
areas.register_hud_handler(myhandler)
=======
Areas mod API
===

View File

@ -1,59 +1,59 @@
local S = areas.intllib
minetest.register_chatcommand("protect", {
params = "<AreaName>",
description = "Protect your own area",
description = S("Protect your own area"),
privs = {[areas.config.self_protection_privilege]=true},
func = function(name, param)
if param == "" then
return false, "Invalid usage, see /help protect."
return false, S("Invalid usage, see /help protect.")
end
local pos1, pos2 = areas:getPos(name)
if not (pos1 and pos2) then
return false, "You need to select an area first."
return false, S("You need to select an area first.")
end
minetest.log("action", "/protect invoked, owner="..name..
minetest.log("action", S("/protect invoked, Owner =")..name..
" AreaName="..param..
" StartPos="..minetest.pos_to_string(pos1)..
" EndPos=" ..minetest.pos_to_string(pos2))
local canAdd, errMsg = areas:canPlayerAddArea(pos1, pos2, name)
if not canAdd then
return false, "You can't protect that area: "..errMsg
return false, S("You can't protect that area: ")..errMsg
end
local id = areas:add(name, param, pos1, pos2, nil)
areas:save()
return true, "Area protected. ID: "..id
return true, S("Area protected. ID: ")..id
end
})
minetest.register_chatcommand("set_owner", {
params = "<PlayerName> <AreaName>",
description = "Protect an area beetween two positions and give"
description = S("Protect an area beetween two positions and give"
.." a player access to it without setting the parent of the"
.." area to any existing area",
.." area to any existing area"),
privs = areas.adminPrivs,
func = function(name, param)
local ownerName, areaName = param:match('^(%S+)%s(.+)$')
if not ownerName then
return false, "Incorrect usage, see /help set_owner."
return false, S("Incorrect usage, see /help set_owner.")
end
local pos1, pos2 = areas:getPos(name)
if not (pos1 and pos2) then
return false, "You need to select an area first."
return false, S("You need to select an area first.")
end
if not areas:player_exists(ownerName) then
return false, "The player \""
..ownerName.."\" does not exist."
return false, S("The player \"@1\" does not exist.", ownerName)
end
minetest.log("action", name.." runs /set_owner. Owner = "..ownerName..
minetest.log("action", name..S(" runs /set_owner. Owner = ")..ownerName..
" AreaName = "..areaName..
" StartPos = "..minetest.pos_to_string(pos1)..
" EndPos = " ..minetest.pos_to_string(pos2))
@ -62,37 +62,36 @@ minetest.register_chatcommand("set_owner", {
areas:save()
minetest.chat_send_player(ownerName,
"You have been granted control over area #"..
id..". Type /list_areas to show your areas.")
return true, "Area protected. ID: "..id
S("You have been granted control over area #@1. Type /list_areas to show your areas.", id))
return true, S("Area protected. ID: ")..id
end
})
minetest.register_chatcommand("add_owner", {
params = "<ParentID> <Player> <AreaName>",
description = "Give a player access to a sub-area beetween two"
description = S("Give a player access to a sub-area beetween two"
.." positions that have already been protected,"
.." Use set_owner if you don't want the parent to be set.",
.." Use set_owner if you don't want the parent to be set."),
func = function(name, param)
local pid, ownerName, areaName
= param:match('^(%d+) ([^ ]+) (.+)$')
if not pid then
minetest.chat_send_player(name, "Incorrect usage, see /help add_owner")
minetest.chat_send_player(name, S("Incorrect usage, see /help add_owner"))
return
end
local pos1, pos2 = areas:getPos(name)
if not (pos1 and pos2) then
return false, "You need to select an area first."
return false, S("You need to select an area first.")
end
if not areas:player_exists(ownerName) then
return false, "The player \""..ownerName.."\" does not exist."
return false, S("The player \"@1\" does not exist.", ownerName)
end
minetest.log("action", name.." runs /add_owner. Owner = "..ownerName..
minetest.log("action", name..S(" runs /add_owner. Owner = ")..ownerName..
" AreaName = "..areaName.." ParentID = "..pid..
" StartPos = "..pos1.x..","..pos1.y..","..pos1.z..
" EndPos = " ..pos2.x..","..pos2.y..","..pos2.z)
@ -101,52 +100,51 @@ minetest.register_chatcommand("add_owner", {
pid = tonumber(pid)
if (not areas:isAreaOwner(pid, name)) or
(not areas:isSubarea(pos1, pos2, pid)) then
return false, "You can't protect that area."
return false, S("You can't protect that area.")
end
local id = areas:add(ownerName, areaName, pos1, pos2, pid)
areas:save()
minetest.chat_send_player(ownerName,
"You have been granted control over area #"..
id..". Type /list_areas to show your areas.")
return true, "Area protected. ID: "..id
S("You have been granted control over area #@1. Type /list_areas to show your areas.", id))
return true, S("Area protected. ID: ")..id
end
})
minetest.register_chatcommand("rename_area", {
params = "<ID> <newName>",
description = "Rename a area that you own",
description = S("Rename a area that you own"),
func = function(name, param)
local id, newName = param:match("^(%d+)%s(.+)$")
if not id then
return false, "Invalid usage, see /help rename_area."
return false, S("Invalid usage, see /help rename_area.")
end
id = tonumber(id)
if not id then
return false, "That area doesn't exist."
return false, S("That area doesn't exist.")
end
if not areas:isAreaOwner(id, name) then
return true, "You don't own that area."
return true, S("You don't own that area.")
end
areas.areas[id].name = newName
areas:save()
return true, "Area renamed."
return true, S("Area renamed.")
end
})
minetest.register_chatcommand("find_areas", {
params = "<regexp>",
description = "Find areas using a Lua regular expression",
description = S("Find areas using a Lua regular expression"),,
privs = areas.adminPrivs,
func = function(name, param)
if param == "" then
return false, "A regular expression is required."
return false, S("A regular expression is required.")
end
-- Check expression for validity
@ -154,7 +152,7 @@ minetest.register_chatcommand("find_areas", {
("Test [1]: Player (0,0,0) (0,0,0)"):find(param)
end
if not pcall(testRegExp) then
return false, "Invalid regular expression."
return false, S("Invalid regular expression.")
end
local matches = {}
@ -167,14 +165,14 @@ minetest.register_chatcommand("find_areas", {
if #matches > 0 then
return true, table.concat(matches, "\n")
else
return true, "No matches found."
return true, S("No matches found.")
end
end
})
minetest.register_chatcommand("list_areas", {
description = "List your areas, or all areas if you are an admin.",
description = S("List your areas, or all areas if you are an admin."),
func = function(name, param)
local admin = minetest.check_player_privs(name, areas.adminPrivs)
local areaStrings = {}
@ -184,7 +182,7 @@ minetest.register_chatcommand("list_areas", {
end
end
if #areaStrings == 0 then
return true, "No visible areas."
return true, S("No visible areas.")
end
return true, table.concat(areaStrings, "\n")
end
@ -193,129 +191,151 @@ minetest.register_chatcommand("list_areas", {
minetest.register_chatcommand("recursive_remove_areas", {
params = "<id>",
description = "Recursively remove areas using an id",
description = S("Recursively remove areas using an id"),
func = function(name, param)
local id = tonumber(param)
if not id then
return false, "Invalid usage, see"
.." /help recursive_remove_areas"
return false, S("Invalid usage, see"
.." /help recursive_remove_areas")
end
if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist or is"
.." not owned by you."
return false, S("Area @1 does not exist or is"
.." not owned by you.", id)
end
areas:remove(id, true)
areas:save()
return true, "Removed area "..id.." and it's sub areas."
return true, S("Removed area @1 and it's sub areas.", id)
end
})
minetest.register_chatcommand("remove_area", {
params = "<id>",
description = "Remove an area using an id",
description = S("Remove an area using an id"),
func = function(name, param)
local id = tonumber(param)
if not id then
return false, "Invalid usage, see /help remove_area"
return false, S("Invalid usage, see /help remove_area")
end
if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist or"
.." is not owned by you."
return false, S("Area @1 does not exist or"
.." is not owned by you.", id)
end
areas:remove(id)
areas:save()
return true, "Removed area "..id
return true, S("Removed area @1", id)
end
})
minetest.register_chatcommand("change_owner", {
params = "<ID> <NewOwner>",
description = "Change the owner of an area using it's ID",
description = S("Change the owner of an area using it's ID"),
func = function(name, param)
local id, newOwner = param:match("^(%d+)%s(%S+)$")
if not id then
return false, "Invalid usage, see"
.." /help change_owner."
return false, S("Invalid usage, see"
.." /help change_owner.")
end
if not areas:player_exists(newOwner) then
return false, "The player \""..newOwner
.."\" does not exist."
return false, S("The player \"@1\" does not exist.", newOwner)
end
id = tonumber(id)
if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist"
.." or is not owned by you."
return false, S("Area @1 does not exist"
.." or is not owned by you.", id)
end
areas.areas[id].owner = newOwner
areas:save()
minetest.chat_send_player(newOwner,
("%s has given you control over the area %q (ID %d).")
:format(name, areas.areas[id].name, id))
return true, "Owner changed."
S("@1 has given you control over the area @2 (ID @3).",name, areas.areas[id].name, id))
return true, S("Owner changed.")
end
})
minetest.register_chatcommand("area_open", {
params = "<ID>",
description = "Toggle an area open (anyone can interact) or closed",
description = S("Toggle an area open (anyone can interact) or closed"),
func = function(name, param)
local id = tonumber(param)
if not id then
return false, "Invalid usage, see /help area_open."
return false, S("Invalid usage, see /help area_open.")
end
if not areas:isAreaOwner(id, name) then
return false, "Area "..id.." does not exist"
.." or is not owned by you."
return false, S("Area @1 does not exist"
.." or is not owned by you.", id)
end
local open = not areas.areas[id].open
local open_msg = open and S("opened") or S("closed")
-- Save false as nil to avoid inflating the DB.
areas.areas[id].open = open or nil
areas:save()
return true, ("Area %s."):format(open and "opened" or "closed")
-- Translators: @1 is one of the previous 'opened' or 'closed'
return true, S("Area @1.", open_msg)
end
})
minetest.register_chatcommand("area_openfarming", {
params = "<ID>",
description = S("Toggle an area open (anyone can interact farming) or closed"),
func = function(name, param)
local id = tonumber(param)
if not id then
return false, S("Invalid usage, see /help area_openfarming.")
end
if not areas:isAreaOwner(id, name) then
return false, S("Area @1 does not exist"
.." or is not owned by you.", id)
end
local openfarming = not areas.areas[id].openfarming
local openfarming_msg = openfarming and S("opened") or S("closed")
-- Save false as nil to avoid inflating the DB.
areas.areas[id].openfarming = openfarming or nil
areas:save()
-- Translators: @1 is one of the previous 'opened' or 'closed'
+ return true, S("Area @1 to farming.", openfarming_msg)
end
})
minetest.register_chatcommand("move_area", {
params = "<ID>",
description = "Move (or resize) an area to the current positions.",
description = S("Move (or resize) an area to the current positions."),
privs = areas.adminPrivs,
func = function(name, param)
local id = tonumber(param)
if not id then
return false, "Invalid usage, see /help move_area."
return false, S("Invalid usage, see /help move_area.")
end
local area = areas.areas[id]
if not area then
return false, "Area does not exist."
return false, S("Area does not exist.")
end
local pos1, pos2 = areas:getPos(name)
if not pos1 then
return false, "You need to select an area first."
return false, S("You need to select an area first.")
end
areas:move(id, area, pos1, pos2)
areas:save()
return true, "Area successfully moved."
return true, S("Area successfully moved.")
end,
})
minetest.register_chatcommand("area_info", {
description = "Get information about area configuration and usage.",
description = S("Get information about area configuration and usage."),
func = function(name, param)
local lines = {}
local privs = minetest.get_player_privs(name)
@ -338,26 +358,25 @@ minetest.register_chatcommand("area_info", {
size_limit_high or size_limit
-- Privilege information
local self_prot_line = ("Self protection is %sabled"):format(
self_prot and "en" or "dis")
local self_prot_msg = self_prot and S("enabled") or S("disabled")
-- Translators: @1 is one of the previous 'enabled' or 'disabled'
local self_prot_line = S("Self protection is @1 ", self_prot_msg)
if self_prot and prot_priv then
local has_prot_priv_msg = has_prot_priv and S("and you") or S("but you don't")
-- Translators: @1 is one of the previous 'and you' or 'but you don't'
self_prot_line = self_prot_line..
(" %s have the neccessary privilege (%q).")
:format(
has_prot_priv and "and you" or
"but you don't",
prot_priv)
S(" @1 have the neccessary privilege (@2).", has_prot_priv_msg, prot_priv)
else
self_prot_line = self_prot_line.."."
end
table.insert(lines, self_prot_line)
if privs.areas then
table.insert(lines, "You are an area"..
" administrator (\"areas\" privilege).")
table.insert(lines, S("You are an area"..
" administrator (\"areas\" privilege)."))
elseif has_high_limit then
table.insert(lines,
"You have extended area protection"..
" limits (\"areas_high_limit\" privilege).")
S("You have extended area protection"..
" limits (\"areas_high_limit\" privilege)."))
end
-- Area count
@ -367,25 +386,24 @@ minetest.register_chatcommand("area_info", {
area_num = area_num + 1
end
end
local count_line = ("You have %d area%s"):format(
area_num, area_num == 1 and "" or "s")
-- Translators: need to use NS gettext to be more precise
local count_line = S("You have @1 area@2", area_num, area_num == 1 and "" or "s")
if privs.areas then
count_line = count_line..
" and have no area protection limits."
S(" and have no area protection limits.")
elseif can_prot then
count_line = count_line..(", out of a maximum of %d.")
:format(max_count)
count_line = count_line..S(", out of a maximum of @1.", max_count)
end
table.insert(lines, count_line)
-- Area size limits
local function size_info(str, size)
table.insert(lines, ("%s spanning up to %dx%dx%d.")
table.insert(lines, (S("%s spanning up to %dx%dx%d."))
:format(str, size.x, size.y, size.z))
end
local function priv_limit_info(priv, max_count, max_size)
size_info(("Players with the %q privilege"..
" can protect up to %d areas"):format(
size_info((S("Players with the %q privilege"
.." can protect up to %d areas")):format(
priv, max_count), max_size)
end
if self_prot then
@ -395,7 +413,7 @@ minetest.register_chatcommand("area_info", {
priv_limit_info("areas_high_limit",
limit_high, size_limit_high)
elseif has_prot_priv then
size_info("You can protect areas", max_size)
size_info(S("You can protect areas"), max_size)
end
end
@ -403,3 +421,60 @@ minetest.register_chatcommand("area_info", {
end,
})
--MFF DEBUT crabman(17/09/2015 ) respawn player at in special area(event) if a spawn is set.
+minetest.register_chatcommand("area_addspawn", {
params = "<ID>",
privs = areas.adminPrivs,
description = S("Define special spawn for area"),
func = function(name, param)
local id = param:match("^(%d+)")
if not id then
return false, S("Invalid usage, see /help area_addspawn.")
end
id = tonumber(id)
if not id then
return false, S("Error, Param id must be int.")
end
local player = minetest.get_player_by_name(name)
if not player then
return false, S("Error, there is not such player")
end
local pos = player:getpos()
if not pos then
return false, S("Error, there is not pos.")
end
if not areas.areas[id] then
return false, S("Area @1 does not exist.", id)
end
areas.areas[id].spawn = pos
areas:save()
return true, S("spawn of area @1 defined.", id)
end
})
minetest.register_chatcommand("area_delspawn", {
params = "<ID>",
privs = areas.adminPrivs,
description = S("Delete special spawn of area"),
func = function(name, param)
local id = param:match("^(%d+)")
if not id then
return false, S("Invalid usage, see /help area_delspawn.")
end
id = tonumber(id)
if not id then
return false, S("Error, Param id must be int.")
end
if not areas.areas[id] then
return false, S("Area @1 does not exist.", id)
end
areas.areas[id].spawn = nil
areas:save()
return true, S("spawn of area @1 deleted.", id)
end
})

1
depends.txt Normal file
View File

@ -0,0 +1 @@
intllib?

86
hud.lua
View File

@ -1,17 +1,37 @@
-- This is inspired by the landrush mod by Bremaweb
local S = areas.intllib
areas.hud = {}
minetest.register_globalstep(function(dtime)
local function tick()
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
local pos = vector.round(player:getpos())
local areaStrings = {}
local area_text = S("No area(s)").."\n\n"
local area_owner_name = ""
local mod_owner = 0
local mod_open = 0
local mod_farming = 0
local area_name = ""
local nb_areas = 0
for id, area in pairs(areas:getAreasAtPos(pos)) do
table.insert(areaStrings, ("%s [%u] (%s%s)")
:format(area.name, id, area.owner,
area.open and ":open" or ""))
nb_areas = nb_areas+1
if areas:isAreaOwner(id, name) then
mod_owner = 1
end
if area.open then
mod_open = 1
end
if area.openfarming then
mod_farming = 1
end
if not area.parent then
area_owner_name = area.owner
area_name = area.name
end
end
for i, area in pairs(areas:getExternalHudEntries(pos)) do
@ -22,33 +42,53 @@ minetest.register_globalstep(function(dtime)
table.insert(areaStrings, str)
end
local areaString = "Areas:"
if #areaStrings > 0 then
areaString = areaString.."\n"..
table.concat(areaStrings, "\n")
local icon = "areas_not_area.png"
if nb_areas > 0 then
local plural = ""
if nb_areas > 1 then
plural = "s"
end
-- Translators: need to use NS gettext to be more precise
area_text = (S("%s\nOwner: %s\n%u area") .. plural):format(area_name, area_owner_name, nb_areas)
icon = ("areas_%u_%u_%u.png"):format(mod_owner, mod_open, mod_farming)
end
local hud = areas.hud[name]
if not hud then
hud = {}
areas.hud[name] = hud
hud.areasId = player:hud_add({
if not areas.hud[name] then
areas.hud[name] = {}
areas.hud[name].icon = player:hud_add({
hud_elem_type = "image",
position = {x=0,y=1},
scale = {x=1,y=1},
offset = {x=26,y=-60},
text = icon,
})
areas.hud[name].areas_id = player:hud_add({
hud_elem_type = "text",
name = "Areas",
number = 0xFFFFFF,
position = {x=0, y=1},
offset = {x=8, y=-8},
text = areaString,
scale = {x=200, y=60},
offset = {x=48, y=-40},
text = area_text,
scale = {x=1, y=1},
alignment = {x=1, y=-1},
})
hud.oldAreas = areaString
return
elseif hud.oldAreas ~= areaString then
player:hud_change(hud.areasId, "text", areaString)
hud.oldAreas = areaString
areas.hud[name].old_area_text = area_text
areas.hud[name].old_icon = icon
else
if areas.hud[name].old_area_text ~= area_text then
player:hud_change(areas.hud[name].areas_id, "text", area_text)
areas.hud[name].old_area_text = area_text
end
if areas.hud[name].old_icon ~= icon then
player:hud_change(areas.hud[name].icon, "text", icon)
areas.hud[name].old_icon = icon
end
end
end
end)
minetest.after(1.5, tick)
end
tick()
minetest.register_on_leaveplayer(function(player)
areas.hud[player:get_player_name()] = nil

View File

@ -4,6 +4,11 @@
areas = {}
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
areas.intllib = S
areas.adminPrivs = {areas=true}
areas.startTime = os.clock()
@ -20,20 +25,20 @@ dofile(areas.modpath.."/hud.lua")
areas:load()
minetest.register_privilege("areas", {
description = "Can administer areas."
description = S("Can administer areas.")
})
minetest.register_privilege("areas_high_limit", {
description = "Can can more, bigger areas."
description = S("Can can more, bigger areas.")
})
if not minetest.registered_privileges[areas.config.self_protection_privilege] then
minetest.register_privilege(areas.config.self_protection_privilege, {
description = "Can protect areas.",
description = S("Can protect areas."),
})
end
if minetest.settings:get_bool("log_mod") then
local diffTime = os.clock() - areas.startTime
minetest.log("action", "areas loaded in "..diffTime.."s.")
minetest.log("action", S("[MOD]areas loaded in @1s.", diffTime))
end

View File

@ -1,3 +1,4 @@
local S = areas.intllib
local old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name)
@ -8,12 +9,16 @@ function minetest.is_protected(pos, name)
end
minetest.register_on_protection_violation(function(pos, name)
local player = minetest.get_player_by_name(name)
local playerpos = player:getpos()
if not areas:canInteract(pos, name) then
local owners = areas:getNodeOwners(pos)
minetest.chat_send_player(name,
("%s is protected by %s."):format(
minetest.pos_to_string(pos),
table.concat(owners, ", ")))
--minetest.chat_send_player(name, (S("%s is protected by %s.")):format(minetest.pos_to_string(pos), table.concat(owners, ", ")))
minetest.chat_send_player(name,(S("%s is protected by %s.")),minetest.pos_to_string(pos),table.concat(owners, ", ")))
minetest.after(1,anti_lag,{player=player,playerpos=playerpos})
end
end)
function anti_lag(player)
player.player:setpos(player.playerpos)
end

View File

@ -1,21 +1,32 @@
local S = areas.intllib
-- Mega_builder privilege
minetest.register_privilege("megabuilder",S("Can protect an infinite amount of areas."))
function areas:player_exists(name)
return minetest.get_auth_handler().get_auth(name) ~= nil
end
local safe_file_write = minetest.safe_file_write
if safe_file_write == nil then
function safe_file_write(path, content)
local file, err = io.open(path, "w")
if err then
return err
end
file:write(content)
file:close()
end
end
-- Save the areas table to a file
function areas:save()
local datastr = minetest.serialize(self.areas)
if not datastr then
minetest.log("error", "[areas] Failed to serialize area data!")
minetest.log("error", S("[areas] Failed to serialize area data!"))
return
end
local file, err = io.open(self.config.filename, "w")
if err then
return err
end
file:write(datastr)
file:close()
return safe_file_write(self.config.filename, datastr)
end
-- Load the areas table from the save file
@ -39,8 +50,8 @@ end
-- @return Whether the ID was valid.
function areas:checkAreaStoreId(sid)
if not sid then
minetest.log("error", "AreaStore failed to find an ID for an "
.."area! Falling back to iterative area checking.")
minetest.log("error", S("AreaStore failed to find an ID for an "
.."area! Falling back to iterative area checking."))
self.store = nil
self.store_ids = nil
end
@ -191,40 +202,45 @@ function areas:canPlayerAddArea(pos1, pos2, name)
-- and if the area is too big.
if not self.config.self_protection or
not privs[areas.config.self_protection_privilege] then
return false, "Self protection is disabled or you do not have"
.." the necessary privilege."
return false, S("Self protection is disabled or you do not have"
.." the necessary privilege.")
end
local max_size = privs.areas_high_limit and
self.config.self_protection_max_size_high or
self.config.self_protection_max_size
if
(pos2.x - pos1.x) > max_size.x or
(pos2.y - pos1.y) > max_size.y or
(pos2.z - pos1.z) > max_size.z then
return false, "Area is too big."
end
-- Check number of areas the user has and make sure it not above the max
local count = 0
for _, area in pairs(self.areas) do
if area.owner == name then
count = count + 1
-- MFF: megabuilders skip checks on size and number of areas.
if not privs["megabuilder"] then
-- Check size
local max_size = privs.areas_high_limit and
self.config.self_protection_max_size_high or
self.config.self_protection_max_size
if
(pos2.x - pos1.x) > max_size.x or
(pos2.y - pos1.y) > max_size.y or
(pos2.z - pos1.z) > max_size.z then
return false, S("Area is too big.")
end
-- Check number of areas the user has and make sure it not above the max
local count = 0
for _, area in pairs(self.areas) do
if area.owner == name then
count = count + 1
end
end
local max_areas = privs.areas_high_limit and
self.config.self_protection_max_areas_high or
self.config.self_protection_max_areas
if count >= max_areas then
return false, S("You have reached the maximum amount of"
.." areas that you are allowed to protect.")
end
end
local max_areas = privs.areas_high_limit and
self.config.self_protection_max_areas_high or
self.config.self_protection_max_areas
if count >= max_areas then
return false, "You have reached the maximum amount of"
.." areas that you are allowed to protect."
end
end
-- Check intersecting areas
local can, id = self:canInteractInArea(pos1, pos2, name)
local can, id = self:canMakeArea(pos1, pos2, name) --MFF crabman(25/02/2016) fix areas in areas
if not can then
local area = self.areas[id]
return false, ("The area intersects with %s [%u] (%s).")
return false, (S("The area intersects with %s [%u] (%s)."))
:format(area.name, id, area.owner)
end

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

View File

@ -1,25 +1,27 @@
-- This file contains functions to convert from
-- the old areas format and other compatability code.
local S = areas.intllib
minetest.register_chatcommand("legacy_load_areas", {
params = "<version>",
description = "Loads, converts, and saves the areas from"
.." a legacy save file.",
description = S("Loads, converts, and saves the areas from"
.." a legacy save file."),
privs = {areas=true, server=true},
func = function(name, param)
minetest.chat_send_player(name, "Converting areas...")
minetest.chat_send_player(name, S("Converting areas..."))
local version = tonumber(param)
if version == 0 then
err = areas:node_ownership_load()
if err then
minetest.chat_send_player(name, "Error loading legacy file: "..err)
minetest.chat_send_player(name, S("Error loading legacy file: ")..err)
return
end
else
minetest.chat_send_player(name, "Invalid version number. (0 allowed)")
minetest.chat_send_player(name, S("Invalid version number. (0 allowed)"))
return
end
minetest.chat_send_player(name, "Legacy file loaded.")
minetest.chat_send_player(name, S("Legacy file loaded."))
for k, area in pairs(areas.areas) do
-- New position format
@ -34,15 +36,15 @@ minetest.register_chatcommand("legacy_load_areas", {
areas:sortPos(area.pos1, area.pos2)
-- Add name
area.name = "unnamed"
area.name = S("unnamed")
-- Remove ID
area.id = nil
end
minetest.chat_send_player(name, "Table format updated.")
minetest.chat_send_player(name, S("Table format updated."))
areas:save()
minetest.chat_send_player(name, "Converted areas saved. Done.")
minetest.chat_send_player(name, S("Converted areas saved. Done."))
end
})
@ -129,7 +131,7 @@ if areas.config.legacy_table then
{x=a.x2, y=a.y2, z=a.z2}
a.x1, a.y1, a.z1, a.x2, a.y2, a.z2 =
nil, nil, nil, nil, nil, nil
a.name = a.name or "unnamed"
a.name = a.name or S("unnamed")
a.id = nil
return rawset(areas.areas, key, a)
end

520
locale/fr.po Normal file
View File

@ -0,0 +1,520 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-02 14:48+0200\n"
"PO-Revision-Date: 2017-08-02 15:35+0200\n"
"Last-Translator: fat115 <fat115@framasoft.org>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.12\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: chatcommands.lua
msgid "Protect your own area"
msgstr "Protéger votre zone"
#: chatcommands.lua
msgid "Invalid usage, see /help protect."
msgstr "Usage incorrect, consultez /help protect"
#: chatcommands.lua
msgid "You need to select an area first."
msgstr "Vous devez d'abord sélectionner une zone."
#: chatcommands.lua
msgid "/protect invoked, Owner ="
msgstr "/protect invoqué, Propriétaire ="
#: chatcommands.lua
msgid "You can't protect that area: "
msgstr "Vous ne pouvez pas protéger cette zone : "
#: chatcommands.lua
msgid "Area protected. ID: "
msgstr "La zone est désormais protégée. Elle porte le N°"
#: chatcommands.lua
msgid ""
"Protect an area beetween two positions and give a player access to it "
"without setting the parent of the area to any existing area"
msgstr ""
"Protéger la zone entre deux positions et en donner l'accès à un joueur sans "
"définir de parent pour cette zone."
#: chatcommands.lua
msgid "Incorrect usage, see /help set_owner."
msgstr "Usage incorrect, consultez /help set_owner"
#: chatcommands.lua
msgid "The player \"@1\" does not exist."
msgstr "Le joueur \"@1\" n'existe pas."
#: chatcommands.lua
msgid " runs /set_owner. Owner = "
msgstr " a lancé /set_owner. Propriétaire = "
#: chatcommands.lua
msgid ""
"You have been granted control over area #@1. Type /list_areas to show your "
"areas."
msgstr ""
"Vous avez le contrôle sur la zone N°@1. Tapez /list pour voir la liste de "
"vos zones."
#: chatcommands.lua
msgid ""
"Give a player access to a sub-area beetween two positions that have already "
"been protected, Use set_owner if you don't want the parent to be set."
msgstr ""
"Donne l'accès à un joueur pour la zone comprise entre deux positions déja "
"protégée. Utilisez plutot set_owner si vous ne souhaitez pas définir le "
"parent."
#: chatcommands.lua
msgid "Incorrect usage, see /help add_owner"
msgstr "Usage incorrect, consultez /help add_owner"
#: chatcommands.lua
msgid " runs /add_owner. Owner = "
msgstr " a lancé /add_owner. Propriétaire = "
#: chatcommands.lua
msgid "You can't protect that area."
msgstr "Vous ne pouvez pas protéger cette zone."
#: chatcommands.lua
msgid "Rename a area that you own"
msgstr "Renommer une zone que vous possédez"
#: chatcommands.lua
msgid "Invalid usage, see /help rename_area."
msgstr "Usage incorrect, consultez /help rename_area."
#: chatcommands.lua
msgid "That area doesn't exist."
msgstr "Cette zone n'existe pas."
#: chatcommands.lua
msgid "You don't own that area."
msgstr "Vous ne possédez pas cette zone."
#: chatcommands.lua
msgid "Area renamed."
msgstr "Zone renommée."
#: chatcommands.lua
msgid "Find areas using a Lua regular expression"
msgstr "Rechercher des zones en utilisant une expression régulière Lua"
#: chatcommands.lua
msgid "A regular expression is required."
msgstr "Une expression régulière est requise."
#: chatcommands.lua
msgid "Invalid regular expression."
msgstr "Expression régulière invalide."
#: chatcommands.lua
msgid "No matches found."
msgstr "Aucun résultat."
#: chatcommands.lua
msgid "List your areas, or all areas if you are an admin."
msgstr "Affiche vos zones (ou toutes les zones si vous êtes administrateur)."
#: chatcommands.lua
msgid "No visible areas."
msgstr "Aucune zone visible."
#: chatcommands.lua
msgid "Recursively remove areas using an id"
msgstr "Supprimer récursivement des zones en utilisant un numéro"
#: chatcommands.lua
msgid "Invalid usage, see /help recursive_remove_areas"
msgstr "Usage incorrect, consultez /help recursive_remove_areas"
#: chatcommands.lua
msgid "Area @1 does not exist or is not owned by you."
msgstr "La zone @1 n'existe pas ou ne vous appartient pas."
#: chatcommands.lua
msgid "Removed area @1 and it's sub areas."
msgstr "Zone @1 supprimée ainsi que toutes ses sous-zones."
#: chatcommands.lua
msgid "Remove an area using an id"
msgstr "Supprimer une zone en utilisant son numéro"
#: chatcommands.lua
msgid "Invalid usage, see /help remove_area"
msgstr "Usage incorrect, consultez /help remove_area"
#: chatcommands.lua
msgid "Removed area @1"
msgstr "Zone @1 supprimée"
#: chatcommands.lua
msgid "Change the owner of an area using it's ID"
msgstr "Modifier le propriétaire d'une zone en utilisant son numéro"
#: chatcommands.lua
msgid "Invalid usage, see /help change_owner."
msgstr "Usage incorrect, consultez /help change_owner."
#: chatcommands.lua
msgid "@1 has given you control over the area @2 (ID @3)."
msgstr "@1 vous a donné le contrôle sur la zone @2 (N° @3)."
#: chatcommands.lua
msgid "Owner changed."
msgstr "Propriétaire modifié."
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact) or closed"
msgstr ""
"Bascule une zone en mode ouvert (nimporte qui peut interagir) ou fermé"
#: chatcommands.lua
msgid "Invalid usage, see /help area_open."
msgstr "Usage incorrect, consultez /help area_open."
#: chatcommands.lua
msgid "closed"
msgstr "fermée"
#: chatcommands.lua
msgid "opened"
msgstr "ouverte"
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1."
msgstr "Zone @1."
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact farming) or closed"
msgstr ""
"Bascule une zone en mode culture ouverte (nimporte qui peut cultiver) ou "
"fermée"
#: chatcommands.lua
msgid "Invalid usage, see /help area_openfarming."
msgstr "Usage incorrect, consultez /help area_openfarming."
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1 to farming."
msgstr "Zone @1 à la culture."
#: chatcommands.lua
msgid "Move (or resize) an area to the current positions."
msgstr "Déplace (ou redimensionne) une zone avec les positions actuelles."
#: chatcommands.lua
msgid "Invalid usage, see /help move_area."
msgstr "Usage incorrect, consultez /help move_area"
#: chatcommands.lua
msgid "Area does not exist."
msgstr "La zone n'existe pas."
#: chatcommands.lua
msgid "Area successfully moved."
msgstr "La zone a été déplacée."
#: chatcommands.lua
msgid "Get information about area configuration and usage."
msgstr "Affiche les informations sur la configuration des zones et leur usage."
#: chatcommands.lua
msgid "disabled"
msgstr "désactivée"
#: chatcommands.lua
msgid "enabled"
msgstr "activée"
#. Translators: @1 is one of the previous 'enabled' or 'disabled'
#: chatcommands.lua
msgid "Self protection is @1 "
msgstr "L'auto-protection est @1 "
#: chatcommands.lua
msgid "and you"
msgstr "et vous avez"
#: chatcommands.lua
msgid "but you don't"
msgstr "mais vous n'avez pas"
#. Translators: @1 is one of the previous 'and you' or 'but you don't'
#: chatcommands.lua
msgid " @1 have the neccessary privilege (@2)."
msgstr " @1 le privilège requis (@2)."
#: chatcommands.lua
msgid "You are an area administrator (\"areas\" privilege)."
msgstr "Vous êtes administrateur de zones (privilège \\\"areas\\\" )."
#: chatcommands.lua
msgid ""
"You have extended area protection limits (\"areas_high_limit\" privilege)."
msgstr ""
"Vous pouvez protéger de grandes zones (privilège \\\"areas_high_limit\\\")."
#. Translators: need to use NS gettext to be more precise
#: chatcommands.lua
msgid "You have @1 area@2"
msgstr "Vous êtes propriétaire de @1 zone@2"
#: chatcommands.lua
msgid " and have no area protection limits."
msgstr " et n'avez pas de limite de protection de zones."
#: chatcommands.lua
msgid ", out of a maximum of @1."
msgstr ", sur un maximum de @1."
#: chatcommands.lua
#, lua-format
msgid "%s spanning up to %dx%dx%d."
msgstr "%s étendue jusquà %dx%dx%d."
#: chatcommands.lua
#, lua-format
msgid "Players with the %q privilege can protect up to %d areas"
msgstr "Les joueurs avec le privilège %q peuvent protéger jusqu'à %d zones"
#: chatcommands.lua
msgid "You can protect areas"
msgstr "Vous pouvez protéger des zones"
#: chatcommands.lua
msgid "Define special spawn for area"
msgstr "Définit un spawn spécifique à une zone"
#: chatcommands.lua
msgid "Invalid usage, see /help area_addspawn."
msgstr "Usage incorrect, consultez /help area_addspawn."
#: chatcommands.lua
msgid "Error, Param id must be int."
msgstr "Erreur, le paramètre id doit être un entier"
#: chatcommands.lua
msgid "Error, there is not such player"
msgstr "Erreur, pas de joueur à ce nom"
#: chatcommands.lua
msgid "Error, there is not pos."
msgstr "Erreur, position invalide."
#: chatcommands.lua
msgid "Area @1 does not exist."
msgstr "La zone @1 n'existe pas."
#: chatcommands.lua
msgid "spawn of area @1 defined."
msgstr "spawn de la zone @1 défini."
#: chatcommands.lua
msgid "Delete special spawn of area"
msgstr "Supprime le spawn spécifique à une zone"
#: chatcommands.lua
msgid "Invalid usage, see /help area_delspawn."
msgstr "Usage incorrect, consultez /help area_delspawn."
#: chatcommands.lua
msgid "spawn of area @1 deleted."
msgstr "spawn de la zone @1 supprimé."
#: hud.lua
msgid "No area(s)"
msgstr "Pas de zone"
#. Translators: need to use NS gettext to be more precise
#: hud.lua
#, lua-format
msgid ""
"%s\n"
"Owner: %s\n"
"%u area"
msgstr ""
"%s\n"
"Propriétaire : %s\n"
"%u zone"
#: init.lua
msgid "Can administer areas."
msgstr "Droit dadministrer des zones"
#: init.lua
msgid "Can can more, bigger areas."
msgstr "Droit de créer des zones plus grandes."
#: init.lua
msgid "Can protect areas."
msgstr "Droit de protéger des zones."
#: init.lua
msgid "[MOD]areas loaded in @1s."
msgstr "[MOD]areas chargé en @1s."
#: interact.lua
#, lua-format
msgid "%s is protected by %s."
msgstr "%s est protégée par %s"
#: internal.lua
msgid "Self protection is disabled or you do not have the necessary privilege."
msgstr ""
"L'auto-protection est désactivée ou vous n'avez pas les privilèges requis."
#: internal.lua
msgid "Area is too big."
msgstr "La zone est trop grande."
#: internal.lua
msgid ""
"You have reached the maximum amount of areas that you are allowed to protect."
msgstr ""
"Vous avez atteint le nombre maximum de zones que vous êtes autorisé a "
"protéger."
#: internal.lua
#, lua-format
msgid "The area intersects with %s [%u] (%s)."
msgstr "Cette zone se recoupe avec %s [%u] (%s)."
#: legacy.lua
msgid "Loads, converts, and saves the areas from a legacy save file."
msgstr "Charge, convertit et sauvegarde les zones depuis un ancien fichier"
#: legacy.lua
msgid "Converting areas..."
msgstr "Conversion des zones..."
#: legacy.lua
msgid "Error loading legacy file: "
msgstr "Erreur de chargement du fichier : "
#: legacy.lua
msgid "Invalid version number. (0 allowed)"
msgstr "Numéro de version incorrect. (0 autorisé)"
#: legacy.lua
msgid "Legacy file loaded."
msgstr "Ancien fichier chargé."
#: legacy.lua
msgid "unnamed"
msgstr "sans nom"
#: legacy.lua
msgid "Table format updated."
msgstr "Format de table mis à jour."
#: legacy.lua
msgid "Converted areas saved. Done."
msgstr "Zones converties sauvegardées. Terminé."
#: pos.lua
msgid "Select a area by id."
msgstr "Sélectionnez une zone par son numéro"
#: pos.lua
msgid "Invalid usage, see /help select_area."
msgstr "Usage incorrect, consultez /help select_area."
#: pos.lua
msgid "The area @1 does not exist."
msgstr "La zone @1 n'existe pas."
#: pos.lua
msgid "Area @1 selected."
msgstr "La zone @1 est sélectionnée."
#: pos.lua
msgid ""
"Set area protection region position 1 to your location or the one specified"
msgstr ""
"Définit la position 1 de la zone à protéger à votre position ou à celle "
"spécifiée"
#: pos.lua
msgid "Unable to get position."
msgstr "Impossible d'utiliser cette position."
#: pos.lua
msgid "Invalid usage, see /help area_pos1."
msgstr "Usage incorect, consultez /help area_pos1."
#: pos.lua
msgid "Area position 1 set to "
msgstr "Position 1 de la zone définie en "
#: pos.lua
msgid ""
"Set area protection region position 2 to your location or the one specified"
msgstr ""
"Définit la position 2 de la zone à protéger à votre position ou à celle "
"spécifiée"
#: pos.lua
msgid "Invalid usage, see /help area_pos2."
msgstr "Usage incorrect, consultez /help area_pos2."
#: pos.lua
msgid "Area position 2 set to "
msgstr "Position 2 de la zone définie en "
#: pos.lua
msgid ""
"Set area protection region, position 1, or position 2 by punching nodes, or "
"display the region"
msgstr ""
"Définit la région de votre zone protégée, position 1 ou position 2 en tapant "
"sur un bloc ou, affiche la région"
#: pos.lua
msgid "Select positions by punching two nodes."
msgstr "Tapez sur deux blocs pour sélectionner les positions."
#: pos.lua
msgid "Select position 1 by punching a node."
msgstr "Choisissez la position 1 en tapant sur un bloc."
#: pos.lua
msgid "Select position 2 by punching a node."
msgstr "Choisissez la position 2 en tapant sur un bloc."
#: pos.lua
msgid "<not set>"
msgstr "<non défini>"
#: pos.lua
msgid "Unknown subcommand: "
msgstr "Sous-commande inconnue : "
#: pos.lua
msgid "Position 1 set to "
msgstr "Position 1 définie en "
#: pos.lua
msgid "Position 2 set to "
msgstr "Position 2 définie en "
#: settings.lua
msgid "Invalid setting type!"
msgstr "Type de réglage invalide !"

395
locale/ru.po Normal file
View File

@ -0,0 +1,395 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-02 14:48+0200\n"
"PO-Revision-Date: 2017-08-15 10:31+0300\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.3\n"
"Last-Translator: inpos <inpos@yandex.ru>\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Language: ru\n"
msgid "Protect your own area"
msgstr "Защитить свою область"
msgid "Invalid usage, see /help protect."
msgstr "Неверное использование, см. /help protect."
msgid "You need to select an area first."
msgstr "Сначала надо выбрать область."
msgid "/protect invoked, Owner ="
msgstr "/protect вызван, Владелец ="
msgid "You can't protect that area: "
msgstr "Вы не можете защитить эту область: "
msgid "Area protected. ID: "
msgstr "Область защищена. ID: "
msgid ""
"Protect an area beetween two positions and give a player access to it "
"without setting the parent of the area to any existing area"
msgstr "Защитите область между двумя позициями и дайте игроку доступ к ней, не "
"устанавливая родителя области в любую существующую область"
msgid "Incorrect usage, see /help set_owner."
msgstr "Неверное использование, см. /help set_owner."
msgid "The player \"@1\" does not exist."
msgstr "Игрок \"@1\" не существует."
msgid " runs /set_owner. Owner = "
msgstr " выполняется /set_owner. Владелец = "
msgid ""
"You have been granted control over area #@1. Type /list_areas to show your "
"areas."
msgstr "Вы дали доступ на управление областью #@1. Наберите /list_areas для вывода "
"списка своих областей."
msgid ""
"Give a player access to a sub-area beetween two positions that have already "
"been protected, Use set_owner if you don't want the parent to be set."
msgstr "Предоставьте игроку доступ к подзоне между двумя уже защищенными позициями. "
"Используйте set_owner, чтобы не устанавливать из родительской области."
msgid "Incorrect usage, see /help add_owner"
msgstr "Неверное использование, см. /help add_owner"
msgid " runs /add_owner. Owner = "
msgstr " выполняется /add_owner. Владелец = "
msgid "You can't protect that area."
msgstr "Вы не можете защитить эту область."
msgid "Rename a area that you own"
msgstr "Переименовать вашу область"
msgid "Invalid usage, see /help rename_area."
msgstr "Неверное использование, см. /help rename_area."
msgid "That area doesn't exist."
msgstr "Такой области не существует."
msgid "You don't own that area."
msgstr "Это не ваша область."
msgid "Area renamed."
msgstr "Область переименована."
msgid "Find areas using a Lua regular expression"
msgstr "Найти области с помощью регулярных выражений Lua"
msgid "A regular expression is required."
msgstr "Требуется регулярное выражение."
msgid "Invalid regular expression."
msgstr "Неверное регулярное выражение."
msgid "No matches found."
msgstr "Совпадений не найдено."
msgid "List your areas, or all areas if you are an admin."
msgstr "Вывести список ваших областей или всех областей, если вы администратор."
msgid "No visible areas."
msgstr "Нет видимых областей."
msgid "Recursively remove areas using an id"
msgstr "Рекурсивно удалить области используя id"
msgid "Invalid usage, see /help recursive_remove_areas"
msgstr "Неверное использование, см. /help recursive_remove_areas"
msgid "Area @1 does not exist or is not owned by you."
msgstr "Область @1 не существует или не принадлежит вам."
msgid "Removed area @1 and it's sub areas."
msgstr "Удалена область @1 и её подзоны."
msgid "Remove an area using an id"
msgstr "Удалить область используя id"
msgid "Invalid usage, see /help remove_area"
msgstr "Неверное использование, см. /help remove_area"
msgid "Removed area @1"
msgstr "Удалена область @1"
msgid "Change the owner of an area using it's ID"
msgstr "Изменить владельца области используя её ID"
msgid "Invalid usage, see /help change_owner."
msgstr "Неверное использование, см. /help change_owner."
msgid "@1 has given you control over the area @2 (ID @3)."
msgstr "@1 дал передал вам управление над областью @2 (ID @3)"
msgid "Owner changed."
msgstr "Владелец изменён."
msgid "Toggle an area open (anyone can interact) or closed"
msgstr "Переключить область в режим открытой (любой может взаимодействовать) или "
"закрытой"
msgid "Invalid usage, see /help area_open."
msgstr "Неверное использование, см. /help area_open."
msgid "closed"
msgstr "закрыта"
msgid "opened"
msgstr "открыта"
#. Translators: @1 is one of the previous 'opened' or 'closed'
msgid "Area @1."
msgstr "Область @1."
msgid "Toggle an area open (anyone can interact farming) or closed"
msgstr "Переключить область в режим открытой (любой может изменять местность) или "
"закрытой"
msgid "Invalid usage, see /help area_openfarming."
msgstr "Неверное использование, см. /help area_openfarming."
#. Translators: @1 is one of the previous 'opened' or 'closed'
msgid "Area @1 to farming."
msgstr "Область @1 для добычи."
msgid "Move (or resize) an area to the current positions."
msgstr "Переместить (или изменить размер) область в текущую позицию."
msgid "Invalid usage, see /help move_area."
msgstr "Неверное использование, см. /help move_area."
msgid "Area does not exist."
msgstr "Область не существует."
msgid "Area successfully moved."
msgstr "Область перемещена."
msgid "Get information about area configuration and usage."
msgstr "Получить информацию о конфигурации и использовании области."
msgid "disabled"
msgstr "отключено"
msgid "enabled"
msgstr "включено"
#. Translators: @1 is one of the previous 'enabled' or 'disabled'
msgid "Self protection is @1 "
msgstr "Самозащита @1 "
msgid "and you"
msgstr "и вы"
msgid "but you don't"
msgstr "но вы не"
#. Translators: @1 is one of the previous 'and you' or 'but you don't'
msgid " @1 have the neccessary privilege (@2)."
msgstr " @1 имеет соответствующие права (@2)."
msgid "You are an area administrator (\"areas\" privilege)."
msgstr "Вы администратор области (права \"areas\")."
msgid ""
"You have extended area protection limits (\"areas_high_limit\" privilege)."
msgstr "У вас расширенный ограничения защиты области (права \"areas_high_limit\")."
#. Translators: need to use NS gettext to be more precise
msgid "You have @1 area@2"
msgstr "У вас @1 область@2"
msgid " and have no area protection limits."
msgstr " и нет ограничений защиты области."
msgid ", out of a maximum of @1."
msgstr ", превышен @1."
#, lua-format
msgid "%s spanning up to %dx%dx%d."
msgstr "%s охватывает до %dx%dx%d."
#, lua-format
msgid "Players with the %q privilege can protect up to %d areas"
msgstr "Игроки с правами %q могут защитить до %d областей."
msgid "You can protect areas"
msgstr "Вы можете защитить области"
msgid "Define special spawn for area"
msgstr "Определить специальную точку порождения для области"
msgid "Invalid usage, see /help area_addspawn."
msgstr "Неверное использование, см. /help area_addspawn."
msgid "Error, Param id must be int."
msgstr "Ошибка, параметр id должен быть целым числом."
msgid "Error, there is not such player"
msgstr "Ошибка, не такого игрока"
msgid "Error, there is not pos."
msgstr "Ошибка, это не позиция."
msgid "Area @1 does not exist."
msgstr "Область @1 не существует."
msgid "spawn of area @1 defined."
msgstr "точка порождения области @1 определена."
msgid "Delete special spawn of area"
msgstr "Удалить специальную точку порождения области"
msgid "Invalid usage, see /help area_delspawn."
msgstr "Неверное использование, см. /help area_delspawn."
msgid "spawn of area @1 deleted."
msgstr "точка порождения области @1 удалена."
msgid "No area(s)"
msgstr "Нет области(ей)"
#. Translators: need to use NS gettext to be more precise
#, lua-format
msgid ""
"%s\n"
"Owner: %s\n"
"%u area"
msgstr "%s\n"
"Владелец: %s\n"
"%u область"
msgid "Can administer areas."
msgstr "Может администрировать область."
msgid "Can can more, bigger areas."
msgstr "Может больше (количество и размер) областей."
msgid "Can protect areas."
msgstr "Может защитить области."
msgid "[MOD]areas loaded in @1s."
msgstr "[MOD]areas загружен в @1s."
#, lua-format
msgid "%s is protected by %s."
msgstr "%s защищено %s."
msgid "Self protection is disabled or you do not have the necessary privilege."
msgstr "Самозащита отключена или у вас нет соответствующих прав."
msgid "Area is too big."
msgstr "Область слишком большая."
msgid ""
"You have reached the maximum amount of areas that you are allowed to protect."
msgstr "Вы превысили допустимое количество областей, которые можете защитить."
#, lua-format
msgid "The area intersects with %s [%u] (%s)."
msgstr "Область пересекается с %s [%u] (%s)."
msgid "Loads, converts, and saves the areas from a legacy save file."
msgstr "Загружает, конвертирует и сохраняет области в файл сохранения наследия."
msgid "Converting areas..."
msgstr "Конвертация областей..."
msgid "Error loading legacy file: "
msgstr "Ошибка загрузки файла наследия: "
msgid "Invalid version number. (0 allowed)"
msgstr "Неверный номер версии. (0 разрешён)"
msgid "Legacy file loaded."
msgstr "Файл наследия загружен."
msgid "unnamed"
msgstr "безымянное"
msgid "Table format updated."
msgstr "Формат таблицы обновлён."
msgid "Converted areas saved. Done."
msgstr "Сконвертированные области сохранены. Выполнено."
msgid "Select a area by id."
msgstr "Выбрать область по id"
msgid "Invalid usage, see /help select_area."
msgstr "Неверное использование, см. /help select_area."
msgid "The area @1 does not exist."
msgstr "Область @1 не существует."
msgid "Area @1 selected."
msgstr "Область @1 выбрана."
msgid ""
"Set area protection region position 1 to your location or the one specified"
msgstr "Установить позицию 1 зоны защиты области в своё местоположение или в "
"указанное"
msgid "Unable to get position."
msgstr "Невозможно получить позицию."
msgid "Invalid usage, see /help area_pos1."
msgstr "Неверное использование, см. /help area_pos1."
msgid "Area position 1 set to "
msgstr "Позиция 1 области установлена в "
msgid ""
"Set area protection region position 2 to your location or the one specified"
msgstr "Установить позицию 2 зоны защиты области в своё местоположение или в "
"указанное"
msgid "Invalid usage, see /help area_pos2."
msgstr "Неверное использование, см. /help area_pos2."
msgid "Area position 2 set to "
msgstr "Позиция 2 области установлена в "
msgid ""
"Set area protection region, position 1, or position 2 by punching nodes, or "
"display the region"
msgstr "Установить зону защиты области, позицию 1 или 2 ударяя узлы, или отобразить "
"зону"
msgid "Select positions by punching two nodes."
msgstr "Выберите позиции ударив два узла."
msgid "Select position 1 by punching a node."
msgstr "Выберите позицию 1 ударив узел."
msgid "Select position 2 by punching a node."
msgstr "Выберите позицию 2 ударив узел."
msgid "<not set>"
msgstr "<не установлено>"
msgid "Unknown subcommand: "
msgstr "Неизвестная подкоманда: "
msgid "Position 1 set to "
msgstr "Позиция 1 установлена в "
msgid "Position 2 set to "
msgstr "Позиция 2 установлена в "
msgid "Invalid setting type!"
msgstr "Неверный тип установки!"

496
locale/template.pot Normal file
View File

@ -0,0 +1,496 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-02 14:48+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: chatcommands.lua
msgid "Protect your own area"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help protect."
msgstr ""
#: chatcommands.lua
msgid "You need to select an area first."
msgstr ""
#: chatcommands.lua
msgid "/protect invoked, Owner ="
msgstr ""
#: chatcommands.lua
msgid "You can't protect that area: "
msgstr ""
#: chatcommands.lua
msgid "Area protected. ID: "
msgstr ""
#: chatcommands.lua
msgid ""
"Protect an area beetween two positions and give a player access to it "
"without setting the parent of the area to any existing area"
msgstr ""
#: chatcommands.lua
msgid "Incorrect usage, see /help set_owner."
msgstr ""
#: chatcommands.lua
msgid "The player \"@1\" does not exist."
msgstr ""
#: chatcommands.lua
msgid " runs /set_owner. Owner = "
msgstr ""
#: chatcommands.lua
msgid ""
"You have been granted control over area #@1. Type /list_areas to show your "
"areas."
msgstr ""
#: chatcommands.lua
msgid ""
"Give a player access to a sub-area beetween two positions that have already "
"been protected, Use set_owner if you don't want the parent to be set."
msgstr ""
#: chatcommands.lua
msgid "Incorrect usage, see /help add_owner"
msgstr ""
#: chatcommands.lua
msgid " runs /add_owner. Owner = "
msgstr ""
#: chatcommands.lua
msgid "You can't protect that area."
msgstr ""
#: chatcommands.lua
msgid "Rename a area that you own"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help rename_area."
msgstr ""
#: chatcommands.lua
msgid "That area doesn't exist."
msgstr ""
#: chatcommands.lua
msgid "You don't own that area."
msgstr ""
#: chatcommands.lua
msgid "Area renamed."
msgstr ""
#: chatcommands.lua
msgid "Find areas using a Lua regular expression"
msgstr ""
#: chatcommands.lua
msgid "A regular expression is required."
msgstr ""
#: chatcommands.lua
msgid "Invalid regular expression."
msgstr ""
#: chatcommands.lua
msgid "No matches found."
msgstr ""
#: chatcommands.lua
msgid "List your areas, or all areas if you are an admin."
msgstr ""
#: chatcommands.lua
msgid "No visible areas."
msgstr ""
#: chatcommands.lua
msgid "Recursively remove areas using an id"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help recursive_remove_areas"
msgstr ""
#: chatcommands.lua
msgid "Area @1 does not exist or is not owned by you."
msgstr ""
#: chatcommands.lua
msgid "Removed area @1 and it's sub areas."
msgstr ""
#: chatcommands.lua
msgid "Remove an area using an id"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help remove_area"
msgstr ""
#: chatcommands.lua
msgid "Removed area @1"
msgstr ""
#: chatcommands.lua
msgid "Change the owner of an area using it's ID"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help change_owner."
msgstr ""
#: chatcommands.lua
msgid "@1 has given you control over the area @2 (ID @3)."
msgstr ""
#: chatcommands.lua
msgid "Owner changed."
msgstr ""
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact) or closed"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_open."
msgstr ""
#: chatcommands.lua
msgid "closed"
msgstr ""
#: chatcommands.lua
msgid "opened"
msgstr ""
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1."
msgstr ""
#: chatcommands.lua
msgid "Toggle an area open (anyone can interact farming) or closed"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_openfarming."
msgstr ""
#. Translators: @1 is one of the previous 'opened' or 'closed'
#: chatcommands.lua
msgid "Area @1 to farming."
msgstr ""
#: chatcommands.lua
msgid "Move (or resize) an area to the current positions."
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help move_area."
msgstr ""
#: chatcommands.lua
msgid "Area does not exist."
msgstr ""
#: chatcommands.lua
msgid "Area successfully moved."
msgstr ""
#: chatcommands.lua
msgid "Get information about area configuration and usage."
msgstr ""
#: chatcommands.lua
msgid "disabled"
msgstr ""
#: chatcommands.lua
msgid "enabled"
msgstr ""
#. Translators: @1 is one of the previous 'enabled' or 'disabled'
#: chatcommands.lua
msgid "Self protection is @1 "
msgstr ""
#: chatcommands.lua
msgid "and you"
msgstr ""
#: chatcommands.lua
msgid "but you don't"
msgstr ""
#. Translators: @1 is one of the previous 'and you' or 'but you don't'
#: chatcommands.lua
msgid " @1 have the neccessary privilege (@2)."
msgstr ""
#: chatcommands.lua
msgid "You are an area administrator (\"areas\" privilege)."
msgstr ""
#: chatcommands.lua
msgid ""
"You have extended area protection limits (\"areas_high_limit\" privilege)."
msgstr ""
#. Translators: need to use NS gettext to be more precise
#: chatcommands.lua
msgid "You have @1 area@2"
msgstr ""
#: chatcommands.lua
msgid " and have no area protection limits."
msgstr ""
#: chatcommands.lua
msgid ", out of a maximum of @1."
msgstr ""
#: chatcommands.lua
#, lua-format
msgid "%s spanning up to %dx%dx%d."
msgstr ""
#: chatcommands.lua
#, lua-format
msgid "Players with the %q privilege can protect up to %d areas"
msgstr ""
#: chatcommands.lua
msgid "You can protect areas"
msgstr ""
#: chatcommands.lua
msgid "Define special spawn for area"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_addspawn."
msgstr ""
#: chatcommands.lua
msgid "Error, Param id must be int."
msgstr ""
#: chatcommands.lua
msgid "Error, there is not such player"
msgstr ""
#: chatcommands.lua
msgid "Error, there is not pos."
msgstr ""
#: chatcommands.lua
msgid "Area @1 does not exist."
msgstr ""
#: chatcommands.lua
msgid "spawn of area @1 defined."
msgstr ""
#: chatcommands.lua
msgid "Delete special spawn of area"
msgstr ""
#: chatcommands.lua
msgid "Invalid usage, see /help area_delspawn."
msgstr ""
#: chatcommands.lua
msgid "spawn of area @1 deleted."
msgstr ""
#: hud.lua
msgid "No area(s)"
msgstr ""
#. Translators: need to use NS gettext to be more precise
#: hud.lua
#, lua-format
msgid ""
"%s\n"
"Owner: %s\n"
"%u area"
msgstr ""
#: init.lua
msgid "Can administer areas."
msgstr ""
#: init.lua
msgid "Can can more, bigger areas."
msgstr ""
#: init.lua
msgid "Can protect areas."
msgstr ""
#: init.lua
msgid "[MOD]areas loaded in @1s."
msgstr ""
#: interact.lua
#, lua-format
msgid "%s is protected by %s."
msgstr ""
#: internal.lua
msgid "Self protection is disabled or you do not have the necessary privilege."
msgstr ""
#: internal.lua
msgid "Area is too big."
msgstr ""
#: internal.lua
msgid ""
"You have reached the maximum amount of areas that you are allowed to protect."
msgstr ""
#: internal.lua
#, lua-format
msgid "The area intersects with %s [%u] (%s)."
msgstr ""
#: legacy.lua
msgid "Loads, converts, and saves the areas from a legacy save file."
msgstr ""
#: legacy.lua
msgid "Converting areas..."
msgstr ""
#: legacy.lua
msgid "Error loading legacy file: "
msgstr ""
#: legacy.lua
msgid "Invalid version number. (0 allowed)"
msgstr ""
#: legacy.lua
msgid "Legacy file loaded."
msgstr ""
#: legacy.lua
msgid "unnamed"
msgstr ""
#: legacy.lua
msgid "Table format updated."
msgstr ""
#: legacy.lua
msgid "Converted areas saved. Done."
msgstr ""
#: pos.lua
msgid "Select a area by id."
msgstr ""
#: pos.lua
msgid "Invalid usage, see /help select_area."
msgstr ""
#: pos.lua
msgid "The area @1 does not exist."
msgstr ""
#: pos.lua
msgid "Area @1 selected."
msgstr ""
#: pos.lua
msgid ""
"Set area protection region position 1 to your location or the one specified"
msgstr ""
#: pos.lua
msgid "Unable to get position."
msgstr ""
#: pos.lua
msgid "Invalid usage, see /help area_pos1."
msgstr ""
#: pos.lua
msgid "Area position 1 set to "
msgstr ""
#: pos.lua
msgid ""
"Set area protection region position 2 to your location or the one specified"
msgstr ""
#: pos.lua
msgid "Invalid usage, see /help area_pos2."
msgstr ""
#: pos.lua
msgid "Area position 2 set to "
msgstr ""
#: pos.lua
msgid ""
"Set area protection region, position 1, or position 2 by punching nodes, or "
"display the region"
msgstr ""
#: pos.lua
msgid "Select positions by punching two nodes."
msgstr ""
#: pos.lua
msgid "Select position 1 by punching a node."
msgstr ""
#: pos.lua
msgid "Select position 2 by punching a node."
msgstr ""
#: pos.lua
msgid "<not set>"
msgstr ""
#: pos.lua
msgid "Unknown subcommand: "
msgstr ""
#: pos.lua
msgid "Position 1 set to "
msgstr ""
#: pos.lua
msgid "Position 2 set to "
msgstr ""
#: settings.lua
msgid "Invalid setting type!"
msgstr ""

53
pos.lua
View File

@ -1,10 +1,11 @@
-- I could depend on WorldEdit for this, but you need to have the 'worldedit'
-- permission to use those commands and you don't have
-- /area_pos{1,2} [X Y Z|X,Y,Z].
-- Since this is mostly copied from WorldEdit it is mostly
-- licensed under the AGPL. (select_area is a exception)
local S = areas.intllib
areas.marker1 = {}
areas.marker2 = {}
areas.set_pos = {}
@ -13,26 +14,26 @@ areas.pos2 = {}
minetest.register_chatcommand("select_area", {
params = "<ID>",
description = "Select a area by id.",
description = S("Select a area by id."),
func = function(name, param)
local id = tonumber(param)
if not id then
return false, "Invalid usage, see /help select_area."
return false, S("Invalid usage, see /help select_area.")
end
if not areas.areas[id] then
return false, "The area "..id.." does not exist."
return false, S("The area @1 does not exist.", id)
end
areas:setPos1(name, areas.areas[id].pos1)
areas:setPos2(name, areas.areas[id].pos2)
return true, "Area "..id.." selected."
return true, S("Area @1 selected.", id)
end,
})
minetest.register_chatcommand("area_pos1", {
params = "[X Y Z|X,Y,Z]",
description = "Set area protection region position 1 to your"
.." location or the one specified",
description = S("Set area protection region position 1 to your"
.." location or the one specified"),
privs = {},
func = function(name, param)
local pos = nil
@ -45,22 +46,22 @@ minetest.register_chatcommand("area_pos1", {
if player then
pos = player:getpos()
else
return false, "Unable to get position."
return false, S("Unable to get position.")
end
else
return false, "Invalid usage, see /help area_pos1."
return false, S("Invalid usage, see /help area_pos1.")
end
pos = vector.round(pos)
areas:setPos1(name, pos)
return true, "Area position 1 set to "
return true, S("Area position 1 set to ")
..minetest.pos_to_string(pos)
end,
})
minetest.register_chatcommand("area_pos2", {
params = "[X Y Z|X,Y,Z]",
description = "Set area protection region position 2 to your"
.." location or the one specified",
description = S("Set area protection region position 2 to your"
.." location or the one specified"),
func = function(name, param)
local pos = nil
local found, _, x, y, z = param:find(
@ -72,14 +73,14 @@ minetest.register_chatcommand("area_pos2", {
if player then
pos = player:getpos()
else
return false, "Unable to get position."
return false, S("Unable to get position.")
end
else
return false, "Invalid usage, see /help area_pos2."
return false, S("Invalid usage, see /help area_pos2.")
end
pos = vector.round(pos)
areas:setPos2(name, pos)
return true, "Area position 2 set to "
return true, S("Area position 2 set to ")
..minetest.pos_to_string(pos)
end,
})
@ -87,33 +88,33 @@ minetest.register_chatcommand("area_pos2", {
minetest.register_chatcommand("area_pos", {
params = "set/set1/set2/get",
description = "Set area protection region, position 1, or position 2"
.." by punching nodes, or display the region",
description = S("Set area protection region, position 1, or position 2"
.." by punching nodes, or display the region"),
func = function(name, param)
if param == "set" then -- Set both area positions
areas.set_pos[name] = "pos1"
return true, "Select positions by punching two nodes."
return true, S("Select positions by punching two nodes.")
elseif param == "set1" then -- Set area position 1
areas.set_pos[name] = "pos1only"
return true, "Select position 1 by punching a node."
return true, S("Select position 1 by punching a node.")
elseif param == "set2" then -- Set area position 2
areas.set_pos[name] = "pos2"
return true, "Select position 2 by punching a node."
return true, S("Select position 2 by punching a node.")
elseif param == "get" then -- Display current area positions
local pos1str, pos2str = "Position 1: ", "Position 2: "
if areas.pos1[name] then
pos1str = pos1str..minetest.pos_to_string(areas.pos1[name])
else
pos1str = pos1str.."<not set>"
pos1str = pos1str..S("<not set>")
end
if areas.pos2[name] then
pos2str = pos2str..minetest.pos_to_string(areas.pos2[name])
else
pos2str = pos2str.."<not set>"
pos2str = pos2str..S("<not set>")
end
return true, pos1str.."\n"..pos2str
else
return false, "Unknown subcommand: "..param
return false, S("Unknown subcommand: ")..param
end
end,
})
@ -149,21 +150,21 @@ minetest.register_on_punchnode(function(pos, node, puncher)
areas.markPos1(name)
areas.set_pos[name] = "pos2"
minetest.chat_send_player(name,
"Position 1 set to "
S("Position 1 set to ")
..minetest.pos_to_string(pos))
elseif areas.set_pos[name] == "pos1only" then
areas.pos1[name] = pos
areas.markPos1(name)
areas.set_pos[name] = nil
minetest.chat_send_player(name,
"Position 1 set to "
S("Position 1 set to ")
..minetest.pos_to_string(pos))
elseif areas.set_pos[name] == "pos2" then
areas.pos2[name] = pos
areas.markPos2(name)
areas.set_pos[name] = nil
minetest.chat_send_player(name,
"Position 2 set to "
S("Position 2 set to ")
..minetest.pos_to_string(pos))
end
end

View File

@ -1,4 +1,5 @@
local world_path = minetest.get_worldpath()
local S = areas.intllib
areas.config = {}
@ -14,7 +15,7 @@ local function setting(tp, name, default)
elseif tp == "number" then
value = tonumber(minetest.settings:get(full_name))
else
error("Invalid setting type!")
error(S("Invalid setting type!"))
end
if value == nil then
value = default
@ -30,7 +31,7 @@ setting("string", "filename", world_path.."/areas.dat")
-- Allow players with a privilege create their own areas
-- within the maximum size and number.
setting("boolean", "self_protection", false)
setting("boolean", "self_protection", true)
setting("string", "self_protection_privilege", "interact")
setting("position", "self_protection_max_size", {x=64, y=128, z=64})
setting("number", "self_protection_max_areas", 4)
@ -40,4 +41,3 @@ setting("number", "self_protection_max_areas_high", 32)
-- legacy_table (owner_defs) compatibility. Untested and has known issues.
setting("boolean", "legacy_table", false)

BIN
textures/areas_0_0_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

BIN
textures/areas_0_0_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

BIN
textures/areas_0_1_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

BIN
textures/areas_0_1_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

BIN
textures/areas_1_0_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

BIN
textures/areas_1_0_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

BIN
textures/areas_1_1_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

BIN
textures/areas_1_1_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

BIN
textures/areas_not_area.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B