srect: localify parsing function

This commit is contained in:
Starbeamrainbowlabs 2021-03-01 21:08:32 +00:00
parent 2acc6b3470
commit e1755ce8e1
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -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