mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-10-16 15:45:27 +02:00
Allow relative coordinate parsing
for //fixedpos, since that's the only relevant command closes #260
This commit is contained in:
@@ -180,13 +180,18 @@ worldedit.register_command("fixedpos", {
|
||||
category = S("Region operations"),
|
||||
privs = {worldedit=true},
|
||||
parse = function(param)
|
||||
local found, _, flag, x, y, z = param:find("^(set[12])%s+([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)$")
|
||||
if found == nil then
|
||||
local found, _, flag, x, y, z = param:find("^(set[12])%s+(~?[+-]?%d+)%s+(~?[+-]?%d+)%s+(~?[+-]?%d+)$")
|
||||
if not found then
|
||||
return false
|
||||
end
|
||||
return true, flag, vector.new(tonumber(x), tonumber(y), tonumber(z))
|
||||
return true, flag, x, y, z
|
||||
end,
|
||||
func = function(name, flag, pos)
|
||||
func = function(name, flag, x, y, z)
|
||||
-- Parse here, since player name isn't known in parse()
|
||||
local pos = worldedit.parse_coordinates(x, y, z, name)
|
||||
if not pos then
|
||||
return false, S("invalid position")
|
||||
end
|
||||
if flag == "set1" then
|
||||
set_pos1(name, pos)
|
||||
else --flag == "set2"
|
||||
|
Reference in New Issue
Block a user