From 727ee41e72fb8da13bff869502214571c6fc791e Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Sun, 28 Feb 2021 09:59:09 -0800 Subject: [PATCH] Simplify srect function --- worldeditadditions/utils/numbers.lua | 4 ++++ worldeditadditions_commands/commands/selectors/srect.lua | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/worldeditadditions/utils/numbers.lua b/worldeditadditions/utils/numbers.lua index 97131a0..f287199 100644 --- a/worldeditadditions/utils/numbers.lua +++ b/worldeditadditions/utils/numbers.lua @@ -58,3 +58,7 @@ function worldeditadditions.getsign(str, type) else return true, "+" end end end + +-- For Testing: +-- worldeditadditions = {} +-- print(worldeditadditions.getsign('-y')) diff --git a/worldeditadditions_commands/commands/selectors/srect.lua b/worldeditadditions_commands/commands/selectors/srect.lua index e06a916..df7bf00 100644 --- a/worldeditadditions_commands/commands/selectors/srect.lua +++ b/worldeditadditions_commands/commands/selectors/srect.lua @@ -41,8 +41,7 @@ worldedit.register_command("srect", { func = function(name, axis1, axis2, len) if axis1 == "get" then axis1 = worldeditadditions.player_axis2d(name) end - local pos1 = worldedit.pos1[name] - local p2 = vector.new(pos1) + local p2 = vector.new(worldedit.pos1[name]) p2[axis1[2]] = p2[axis1[2]] + tonumber(len) * axis1[1] p2[axis2[2]] = p2[axis2[2]] + tonumber(len) * axis2[1]