mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-08-20 21:44:06 +02:00
srect: minor formatting tidyup
This commit is contained in:
parent
9f01703744
commit
8cce699313
@ -6,7 +6,7 @@
|
|||||||
worldedit.register_command("srect", {
|
worldedit.register_command("srect", {
|
||||||
params = "[<axis1> [<axis2>]] <length>",
|
params = "[<axis1> [<axis2>]] <length>",
|
||||||
description = "Set WorldEdit region position 2 at a set distance along 2 axes.",
|
description = "Set WorldEdit region position 2 at a set distance along 2 axes.",
|
||||||
privs = {worldedit=true},
|
privs = { worldedit = true },
|
||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local wea = worldeditadditions
|
local wea = worldeditadditions
|
||||||
@ -14,18 +14,17 @@ worldedit.register_command("srect", {
|
|||||||
local ax1, ax2, len = find[1], find[2], find[table.maxn(find)]
|
local ax1, ax2, len = find[1], find[2], find[table.maxn(find)]
|
||||||
|
|
||||||
-- 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
|
else
|
||||||
local success, value = wea.getsign(ax1, "int")
|
local success, value = wea.getsign(ax1, "int")
|
||||||
if not success then return success, value
|
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
|
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")
|
||||||
if not success then return success, value end
|
if not success then return success, value end
|
||||||
ax2 = { value, ax2:gsub('[^xyz]',''):sub(1,1) }
|
ax2 = { value, ax2:gsub('[^xyz]', ''):sub(1, 1) }
|
||||||
|
|
||||||
len = tonumber(len)
|
len = tonumber(len)
|
||||||
-- If len == nill cancel the operation
|
-- If len == nill cancel the operation
|
||||||
|
Loading…
Reference in New Issue
Block a user