mirror of
https://github.com/minetest-mods/areas
synced 2025-11-22 06:27:58 +01:00
Error message for < 5.7.0
This commit is contained in:
parent
43f02ba6dd
commit
a9b2c7ef94
@ -133,3 +133,5 @@ Set area protection region, position 1, or position 2 by punching nodes, or disp
|
||||
The area @1 does not exist.=La zone @1 n’existe pas.
|
||||
Unable to get position.=Impossible d’obtenir la position.
|
||||
Unknown subcommand: @1=Sous-commande inconnue : @1
|
||||
|
||||
Relative coordinates is not supported on this server. Please upgrade Minetest to 5.7.0 or newer versions.=
|
||||
|
||||
@ -133,3 +133,5 @@ Set area protection region, position 1, or position 2 by punching nodes, or disp
|
||||
The area @1 does not exist.=L'area @1 non esiste.
|
||||
Unable to get position.=Impossibile ottenere la posizione.
|
||||
Unknown subcommand: @1=Sotto-comando sconosciuto: @1
|
||||
|
||||
Relative coordinates is not supported on this server. Please upgrade Minetest to 5.7.0 or newer versions.=
|
||||
|
||||
@ -133,3 +133,5 @@ Set area protection region, position 1, or position 2 by punching nodes, or disp
|
||||
The area @1 does not exist.=Территория @1 не существует.
|
||||
Unable to get position.=Не удалось получить позицию.
|
||||
Unknown subcommand: @1=Неизвестная под-команда/аргумент.
|
||||
|
||||
Relative coordinates is not supported on this server. Please upgrade Minetest to 5.7.0 or newer versions.=
|
||||
|
||||
@ -132,4 +132,6 @@ Set area protection region, position 1, or position 2 by punching nodes, or disp
|
||||
|
||||
The area @1 does not exist.=保护区 @1 不存在。
|
||||
Unable to get position.=无法获得座标。
|
||||
Unknown subcommand: @1=子指令不明:@1
|
||||
Unknown subcommand: @1=子指令不明:@1
|
||||
|
||||
Relative coordinates is not supported on this server. Please upgrade Minetest to 5.7.0 or newer versions.=此服务器不支援相对座标。请更新Minetest至5.7.0或之后的版本。
|
||||
@ -133,3 +133,5 @@ Set area protection region, position 1, or position 2 by punching nodes, or disp
|
||||
The area @1 does not exist.=保護區 @1 不存在。
|
||||
Unable to get position.=無法獲得座標。
|
||||
Unknown subcommand: @1=子指令不明:@1
|
||||
|
||||
Relative coordinates is not supported on this server. Please upgrade Minetest to 5.7.0 or newer versions.=此伺服器不支援相對座標。請更新Minetest至5.7.0或之後的版本。
|
||||
|
||||
@ -133,3 +133,5 @@ Set area protection region, position 1, or position 2 by punching nodes, or disp
|
||||
The area @1 does not exist.=
|
||||
Unable to get position.=
|
||||
Unknown subcommand: @1=
|
||||
|
||||
Relative coordinates is not supported on this server. Please upgrade Minetest to 5.7.0 or newer versions.=
|
||||
|
||||
57
pos.lua
57
pos.lua
@ -22,6 +22,37 @@ local function posLimit(pos)
|
||||
}
|
||||
end
|
||||
|
||||
local parse_relative_pos
|
||||
|
||||
if minetest.parse_relative_number then
|
||||
parse_relative_pos = function(x_str, y_str, z_str, pos)
|
||||
|
||||
local x = pos and minetest.parse_relative_number(x_str, pos.x)
|
||||
or tonumber(x_str)
|
||||
local y = pos and minetest.parse_relative_number(y_str, pos.y)
|
||||
or tonumber(y_str)
|
||||
local z = pos and minetest.parse_relative_number(z_str, pos.z)
|
||||
or tonumber(z_str)
|
||||
if x and y and z then
|
||||
return vector.new(x, y, z)
|
||||
end
|
||||
end
|
||||
else
|
||||
parse_relative_pos = function(x_str, y_str, z_str, pos)
|
||||
local x = tonumber(x_str)
|
||||
local y = tonumber(y_str)
|
||||
local z = tonumber(z_str)
|
||||
if x and y and z then
|
||||
return vector.new(x, y, z)
|
||||
elseif string.sub(x_str, 1, 1) == "~"
|
||||
or string.sub(y_str, 1, 1) == "~"
|
||||
or string.sub(z_str, 1, 1) == "~" then
|
||||
return nil, S("Relative coordinates is not supported on this server. " ..
|
||||
"Please upgrade Minetest to 5.7.0 or newer versions.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("select_area", {
|
||||
params = S("<ID>"),
|
||||
description = S("Select an area by ID."),
|
||||
@ -54,14 +85,11 @@ minetest.register_chatcommand("area_pos1", {
|
||||
local found, _, x_str, y_str, z_str = param:find(
|
||||
"^(~?-?%d*)[, ](~?-?%d*)[, ](~?-?%d*)$")
|
||||
if found then
|
||||
local x = pos and minetest.parse_relative_number(x_str, pos.x)
|
||||
or tonumber(x_str)
|
||||
local y = pos and minetest.parse_relative_number(y_str, pos.y)
|
||||
or tonumber(y_str)
|
||||
local z = pos and minetest.parse_relative_number(z_str, pos.z)
|
||||
or tonumber(z_str)
|
||||
if x and y and z then
|
||||
pos = { x = x, y = y, z = z }
|
||||
local get_pos, reason = parse_relative_pos(x_str, y_str, z_str, pos)
|
||||
if get_pos then
|
||||
pos = get_pos
|
||||
elseif not get_pos and reason then
|
||||
return false, reason
|
||||
end
|
||||
elseif param ~= "" then
|
||||
return false, S("Invalid usage, see /help @1.", "area_pos1")
|
||||
@ -89,14 +117,11 @@ minetest.register_chatcommand("area_pos2", {
|
||||
local found, _, x_str, y_str, z_str = param:find(
|
||||
"^(~?-?%d*)[, ](~?-?%d*)[, ](~?-?%d*)$")
|
||||
if found then
|
||||
local x = pos and minetest.parse_relative_number(x_str, pos.x)
|
||||
or tonumber(x_str)
|
||||
local y = pos and minetest.parse_relative_number(y_str, pos.y)
|
||||
or tonumber(y_str)
|
||||
local z = pos and minetest.parse_relative_number(z_str, pos.z)
|
||||
or tonumber(z_str)
|
||||
if x and y and z then
|
||||
pos = { x = x, y = y, z = z }
|
||||
local get_pos, reason = parse_relative_pos(x_str, y_str, z_str, pos)
|
||||
if get_pos then
|
||||
pos = get_pos
|
||||
elseif not get_pos and reason then
|
||||
return false, reason
|
||||
end
|
||||
elseif param ~= "" then
|
||||
return false, S("Invalid usage, see /help @1.", "area_pos2")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user