Rework on messages displayed

Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
master
Louis Royer 2020-03-15 21:04:12 +01:00 committed by MoNTE48
parent c1530388ad
commit 0288a199fc
3 changed files with 33 additions and 68 deletions

View File

@ -37,7 +37,7 @@ minetest.register_chatcommand("protect", {
minetest.register_chatcommand("set_owner", { minetest.register_chatcommand("set_owner", {
params = S("<PlayerName>").." "..S("<AreaName>"), params = S("<PlayerName>").." "..S("<AreaName>"),
description = S("Protect an area beetween two positions and give" description = S("Protect an area between two positions and give"
.." a player access to it without setting the parent of the" .." a player access to it without setting the parent of the"
.." area to any existing area"), .." area to any existing area"),
privs = areas.adminPrivs, privs = areas.adminPrivs,
@ -121,7 +121,7 @@ minetest.register_chatcommand("add_owner", {
minetest.register_chatcommand("rename_area", { minetest.register_chatcommand("rename_area", {
params = S("<ID>").." "..S("<newName>"), params = S("<ID>").." "..S("<newName>"),
description = S("Rename a area that you own"), description = S("Rename an area that you own"),
func = function(name, param) func = function(name, param)
local id, newName = param:match("^(%d+)%s(.+)$") local id, newName = param:match("^(%d+)%s(.+)$")
if not id then if not id then
@ -145,7 +145,7 @@ minetest.register_chatcommand("rename_area", {
minetest.register_chatcommand("find_areas", { minetest.register_chatcommand("find_areas", {
params = S("<regexp>"), params = "<regexp>",
description = S("Find areas using a Lua regular expression"), description = S("Find areas using a Lua regular expression"),
privs = areas.adminPrivs, privs = areas.adminPrivs,
func = function(name, param) func = function(name, param)
@ -209,7 +209,7 @@ minetest.register_chatcommand("list_areas", {
minetest.register_chatcommand("recursive_remove_areas", { minetest.register_chatcommand("recursive_remove_areas", {
params = S("<ID>"), params = S("<ID>"),
description = S("Recursively remove areas using an id"), description = S("Recursively remove areas using an ID"),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then
@ -231,7 +231,7 @@ minetest.register_chatcommand("recursive_remove_areas", {
minetest.register_chatcommand("remove_area", { minetest.register_chatcommand("remove_area", {
params = S("<ID>"), params = S("<ID>"),
description = S("Remove an area using an id"), description = S("Remove an area using an ID"),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
@ -256,7 +256,7 @@ minetest.register_chatcommand("remove_area", {
minetest.register_chatcommand("change_owner", { minetest.register_chatcommand("change_owner", {
params = S("<ID>").." "..S("<NewOwner>"), params = S("<ID>").." "..S("<NewOwner>"),
description = S("Change the owner of an area using it's ID"), description = S("Change the owner of an area using its ID"),
func = function(name, param) func = function(name, param)
local id, newOwner = param:match("^(%d+)%s(%S+)$") local id, newOwner = param:match("^(%d+)%s(%S+)$")
if not id then if not id then
@ -356,27 +356,15 @@ minetest.register_chatcommand("area_info", {
local max_size = has_high_limit and local max_size = has_high_limit and
size_limit_high or size_limit size_limit_high or size_limit
-- Privilege information -- Self protection information
local self_prot_line = (self_prot and prot_priv) and local self_prot_line = self_prot and S("Self protection is enabled.") or
(has_prot_priv and S("Self protection is disabled.")
(self_prot and
S("Self protection is enabled and you have the "..
"necessary privilege (\"@1\").", prot_priv) or
S("Self protection is disabled and you have the "..
"necessary privilege (\"@1\").", prot_priv)
) or
(self_prot and
S("Self protection is enabled but you don't have the "..
"necessary privilege (\"@1\").", prot_priv) or
S("Self protection is disabled but you don't have the "..
"necessary privilege (\"@1\").", prot_priv)
)
) or
(self_prot and
S("Self protection is enabled.") or
S("Self protection is disabled.")
)
table.insert(lines, self_prot_line) table.insert(lines, self_prot_line)
-- Privilege information
local priv_line = has_prot_priv and
S("You have the necessary privilege (\"@1\").", prot_priv) or
S("You don't have the necessary privilege (\"@1\").", prot_priv)
table.insert(lines, priv_line)
if privs.areas then if privs.areas then
table.insert(lines, S("You are an area".. table.insert(lines, S("You are an area"..
" administrator (\"areas\" privilege).")) " administrator (\"areas\" privilege)."))
@ -393,25 +381,14 @@ minetest.register_chatcommand("area_info", {
area_num = area_num + 1 area_num = area_num + 1
end end
end end
local count_line = privs.areas and
((area_num <= 1) and table.insert(lines, S("You have @1 areas.", area_num))
S("You have @1 area and have no area "..
"protection limits.", area_num) or -- Area limit
S("You have @1 areas and have no area ".. local area_limit_line = privs.areas and
"protection limits.", area_num) S("Limit: no area count limit") or
) or S("Limit: @1 areas", max_count)
(can_prot and ( table.insert(lines, area_limit_line)
(area_num <= 1) and
S("You have @1 area, out of a "..
"maximum of @2.", area_num, max_count) or
S("You have @1 areas, out of a "..
"maximum of @2.", area_num, max_count)
) or
(area_num <= 1) and
S("You have @1 area.", area_num) or
S("You have @1 areas.", area_num)
)
table.insert(lines, count_line)
-- Area size limits -- Area size limits
local function size_info(str, size) local function size_info(str, size)

View File

@ -8,7 +8,6 @@
<ParentID>= <ParentID>=
<PlayerName>= <PlayerName>=
<newName>= <newName>=
<regexp>=
@1 has given you control over the area "@2" (ID @3).= @1 has given you control over the area "@2" (ID @3).=
@1 spanning up to @2x@3x@4.= @1 spanning up to @2x@3x@4.=
A regular expression is required.= A regular expression is required.=
@ -21,13 +20,15 @@ Area opened.=
Area protected. ID: @1= Area protected. ID: @1=
Area renamed.= Area renamed.=
Area successfully moved.= Area successfully moved.=
Change the owner of an area using it's ID= Change the owner of an area using its ID=
Find areas using a Lua regular expression= Find areas using a Lua regular expression=
Get information about area configuration and usage.= Get information about area configuration and usage.=
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.= 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.=
Invalid regular expression.= Invalid regular expression.=
Limit: @1 areas=
Limit: no area count limit=
List your areas, or all areas if you are an admin.= List your areas, or all areas if you are an admin.=
Move (or resize) an area to the current positions.= Move (or resize) an area to the current positions.=
No matches found.= No matches found.=
@ -35,25 +36,15 @@ No visible areas.=
Owner changed.= Owner changed.=
Players with the "@1" privilege can protect up to @2 areas= Players with the "@1" privilege can protect up to @2 areas=
Protect an area beetween two positions and give a player access to it without setting the parent of the area to any existing area= Protect an area between two positions and give a player access to it without setting the parent of the area to any existing area=
Protect your own area= Protect your own area=
Recursively remove areas using an id= Recursively remove areas using an ID=
Remove an area using an id= Remove an area using an ID=
Removed area @1= Removed area @1=
Removed area @1 and it's sub areas.= Removed area @1 and it's sub areas.=
Rename a area that you own= Rename an area that you own=
Self protection is disabled and you have the necessary privilege ("@1").=
Self protection is disabled but you don't have the necessary privilege ("@1").=
Self protection is disabled.= Self protection is disabled.=
Self protection is enabled and you have the necessary privilege ("@1").=
Self protection is enabled but you don't have the necessary privilege ("@1").=
Self protection is enabled.= Self protection is enabled.=
That area doesn't exist.= That area doesn't exist.=
The player "@1" does not exist.= The player "@1" does not exist.=
@ -63,18 +54,15 @@ You are an area administrator ("areas" privilege).=
You can protect areas= You can protect areas=
You can't protect that area.= You can't protect that area.=
You can't protect that area: @1= You can't protect that area: @1=
You don't have the necessary privilege ("@1").=
You don't own that area.= You don't own that area.=
You have @1 area and have no area protection limits.=
You have @1 area, out of a maximum of @2.=
You have @1 area.=
You have @1 areas and have no area protection limits.=
You have @1 areas, out of a maximum of @2.=
You have @1 areas.= You have @1 areas.=
You have been granted control over area #@1. Type /list_areas to show your areas.= You have been granted control over area #@1. Type /list_areas to show your areas.=
You have extended area protection limits ("areas_high_limit" privilege).= You have extended area protection limits ("areas_high_limit" privilege).=
You have the necessary privilege ("@1").=
You need to select an area first.= You need to select an area first.=
### chatcommands.lua ### ### chatcommands.lua ###
@ -124,7 +112,7 @@ Area @1 selected.=
Area position @1 set to @2= Area position @1 set to @2=
Position @1 set to @2= Position @1 set to @2=
Position @1: = Position @1: =
Select a area by id.= Select an area by ID.=
Select position @1 by punching a node.= Select position @1 by punching a node.=
Select positions by punching two nodes.= Select positions by punching two nodes.=

View File

@ -23,7 +23,7 @@ end
minetest.register_chatcommand("select_area", { minetest.register_chatcommand("select_area", {
params = S("<ID>"), params = S("<ID>"),
description = S("Select a area by id."), description = S("Select an area by ID."),
func = function(name, param) func = function(name, param)
local id = tonumber(param) local id = tonumber(param)
if not id then if not id then