mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 15:33:00 +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
|
||||
function parse_params_srect(params_text)
|
||||
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 wea = worldeditadditions
|
||||
local find = wea.split(params_text, "%s", false)
|
||||
local ax1, ax2, len = find[1], find[2], find[table.maxn(find)]
|
||||
|
@ -30,15 +34,6 @@ function parse_params_srect(params_text)
|
|||
end
|
||||
|
||||
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,
|
||||
func = function(name, axis1, axis2, len)
|
||||
if axis1 == "get" then axis1 = worldeditadditions.player_axis2d(name) end
|
||||
|
|
Loading…
Reference in a new issue