From ff9abded2e45d8733a8b9bf867aa83a22c9f9516 Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Wed, 10 Mar 2021 20:56:38 -0800 Subject: [PATCH] localize wea --- worldeditadditions_commands/commands/selectors/scol.lua | 5 +++-- worldeditadditions_commands/commands/selectors/scube.lua | 7 ++++--- worldeditadditions_commands/commands/selectors/srect.lua | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/worldeditadditions_commands/commands/selectors/scol.lua b/worldeditadditions_commands/commands/selectors/scol.lua index 475aa92..08a2c36 100644 --- a/worldeditadditions_commands/commands/selectors/scol.lua +++ b/worldeditadditions_commands/commands/selectors/scol.lua @@ -3,13 +3,14 @@ -- ███████ ██ ██ ██ ██ -- ██ ██ ██ ██ ██ -- ███████ ██████ ██████ ███████ +local wea = worldeditadditions worldedit.register_command("scol", { params = "[] ", description = "Set WorldEdit region position 2 at a set distance along 1 axis.", privs = {worldedit=true}, require_pos = 1, parse = function(params_text) - local wea, vec, tmp = worldeditadditions, vector.new(0, 0, 0), {} + local vec, tmp = vector.new(0, 0, 0), {} local find = wea.split(params_text, "%s", false) local ax1, sn1, len = (tostring(find[1]):match('[xyz]') or "g"):sub(1,1), wea.getsign(find[1]), find[table.maxn(find)] @@ -24,7 +25,7 @@ worldedit.register_command("scol", { end, func = function(name, vec, tmp) if tmp.get then - local ax, dir = worldeditadditions.player_axis2d(name) + local ax, dir = wea.player_axis2d(name) vec[ax] = tmp.len * dir end diff --git a/worldeditadditions_commands/commands/selectors/scube.lua b/worldeditadditions_commands/commands/selectors/scube.lua index 44f3258..b3d337e 100644 --- a/worldeditadditions_commands/commands/selectors/scube.lua +++ b/worldeditadditions_commands/commands/selectors/scube.lua @@ -3,13 +3,14 @@ -- ███████ ██ ██ ██ ██████ █████ -- ██ ██ ██ ██ ██ ██ ██ -- ███████ ██████ ██████ ██████ ███████ +local wea = worldeditadditions worldedit.register_command("scube", { params = "[ [ []]] ", description = "Set WorldEdit region position 2 at a set distance along 3 axes.", privs = { worldedit = true }, require_pos = 1, parse = function(params_text) - local wea, vec, tmp = worldeditadditions, vector.new(0, 0, 0), {} + local vec, tmp = vector.new(0, 0, 0), {} local find = wea.split(params_text, "%s", false) local ax1, ax2, ax3 = (tostring(find[1]):match('[xyz]') or "g"):sub(1,1), (tostring(find[2]):match('[xyz]') or "g"):sub(1,1), (tostring(find[3]):match('[xyz]') or "g"):sub(1,1) @@ -31,8 +32,8 @@ worldedit.register_command("scube", { end, func = function(name, vec, tmp) if tmp.get then - local ax, dir = worldeditadditions.player_axis2d(name) - local _, left, sn = worldeditadditions.axis_left(ax,dir) + local ax, dir = wea.player_axis2d(name) + local _, left, sn = wea.axis_left(ax,dir) if not tmp.axes:find("x") then vec.x = tmp.len * (ax == "x" and dir or sn) end if not tmp.axes:find("z") then vec.z = tmp.len * (ax == "z" and dir or sn) end if not tmp.axes:find("y") then vec.y = tmp.len end diff --git a/worldeditadditions_commands/commands/selectors/srect.lua b/worldeditadditions_commands/commands/selectors/srect.lua index 0c9353c..9c478fa 100644 --- a/worldeditadditions_commands/commands/selectors/srect.lua +++ b/worldeditadditions_commands/commands/selectors/srect.lua @@ -3,13 +3,14 @@ -- ███████ ██████ █████ ██ ██ -- ██ ██ ██ ██ ██ ██ -- ███████ ██ ██ ███████ ██████ ██ +local wea = worldeditadditions worldedit.register_command("srect", { params = "[ []] ", 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, vec, tmp = worldeditadditions, vector.new(0, 0, 0), {} + local vec, tmp = vector.new(0, 0, 0), {} local find = wea.split(params_text, "%s", false) local ax1, ax2 = (tostring(find[1]):match('[xyz]') or "g"):sub(1,1), (tostring(find[2]):match('[xyz]') or "g"):sub(1,1) local sn1, sn2, len = wea.getsign(find[1]), wea.getsign(find[2]), find[table.maxn(find)] @@ -28,7 +29,7 @@ worldedit.register_command("srect", { end, func = function(name, vec, tmp) if tmp.get then - local ax, dir = worldeditadditions.player_axis2d(name) + local ax, dir = wea.player_axis2d(name) if not tmp.axes:find("[xz]") then vec[ax] = tmp.len * dir end if not tmp.axes:find("y") then vec.y = tmp.len end end