stable axis1 processing

This commit is contained in:
VorTechnix 2021-02-28 11:59:46 -08:00
parent 727ee41e72
commit 12e5be8da6

@ -11,10 +11,12 @@ function parse_params_srect(params_text)
-- If ax1 is bad set to player facing dir -- If ax1 is bad set to player facing dir
if ax1 == len or not ax1:match('[xyz]') then ax1 = "get" if ax1 == len or not ax1:match('[xyz]') then ax1 = "get"
else
local success, value = wea.getsign(ax1, "int") local success, value = wea.getsign(ax1, "int")
if not success then return success, value end if not success then return success, value
else ax1 = { value, ax1:gsub('[^xyz]',''):sub(1,1) } else ax1 = { value, ax1:gsub('[^xyz]',''):sub(1,1) }
end end
end
-- If ax2 is bad set to +y -- If ax2 is bad set to +y
if not ax2 or ax2 == len or not ax2:match('[xyz]') then ax2 = "y" end if not ax2 or ax2 == len or not ax2:match('[xyz]') then ax2 = "y" end
local success, value = wea.getsign(ax2, "int") local success, value = wea.getsign(ax2, "int")
@ -54,3 +56,9 @@ worldedit.register_command("srect", {
-- Tests -- Tests
-- /multi //fp set1 -63 19 -20 //srect 5 -- /multi //fp set1 -63 19 -20 //srect 5
-- /multi //fp set1 -63 19 -20 //srect z 5
-- /multi //fp set1 -63 19 -20 //srect a z 5
-- /multi //fp set1 -63 19 -20 //srect z a 5
-- /multi //fp set1 -63 19 -20 //srect -z 5
-- /multi //fp set1 -63 19 -20 //srect a -x 5
-- /multi //fp set1 -63 19 -20 //srect -x -a 5