mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 09:03:01 +00:00
srect: localify parsing function
This commit is contained in:
parent
2acc6b3470
commit
e1755ce8e1
1 changed files with 25 additions and 30 deletions
|
@ -3,8 +3,12 @@
|
||||||
-- ███████ ██████ █████ ██ ██
|
-- ███████ ██████ █████ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██
|
||||||
-- ███████ ██ ██ ███████ ██████ ██
|
-- ███████ ██ ██ ███████ ██████ ██
|
||||||
-- local -- TODO: set this to local once development is finished
|
worldedit.register_command("srect", {
|
||||||
function parse_params_srect(params_text)
|
params = "[<axis1> [<axis2>]] <length>",
|
||||||
|
description = "Set WorldEdit region position 2 at a set distance along 2 axes.",
|
||||||
|
privs = {worldedit=true},
|
||||||
|
require_pos = 1,
|
||||||
|
parse = function(params_text)
|
||||||
local wea = worldeditadditions
|
local wea = worldeditadditions
|
||||||
local find = wea.split(params_text, "%s", false)
|
local find = wea.split(params_text, "%s", false)
|
||||||
local ax1, ax2, len = find[1], find[2], find[table.maxn(find)]
|
local ax1, ax2, len = find[1], find[2], find[table.maxn(find)]
|
||||||
|
@ -30,15 +34,6 @@ function parse_params_srect(params_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
return true, ax1, ax2, len
|
return true, ax1, ax2, len
|
||||||
end
|
|
||||||
worldedit.register_command("srect", {
|
|
||||||
params = "[<axis1> [<axis2>]] <length>",
|
|
||||||
description = "Set WorldEdit region position 2 at a set distance along 2 axes.",
|
|
||||||
privs = {worldedit=true},
|
|
||||||
require_pos = 1,
|
|
||||||
parse = function(params_text)
|
|
||||||
local values = {parse_params_srect(params_text)}
|
|
||||||
return unpack(values)
|
|
||||||
end,
|
end,
|
||||||
func = function(name, axis1, axis2, len)
|
func = function(name, axis1, axis2, len)
|
||||||
if axis1 == "get" then axis1 = worldeditadditions.player_axis2d(name) end
|
if axis1 == "get" then axis1 = worldeditadditions.player_axis2d(name) end
|
||||||
|
|
Loading…
Reference in a new issue