From ffd7d48fe25e465ec633d6ed354ce3cc0aac2381 Mon Sep 17 00:00:00 2001 From: shagu Date: Tue, 26 Nov 2024 21:22:20 +0100 Subject: [PATCH] librange: add z-axis to superwow range detection --- libs/librange.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/librange.lua b/libs/librange.lua index 10ba9042..c6e9c1a2 100644 --- a/libs/librange.lua +++ b/libs/librange.lua @@ -163,11 +163,11 @@ librange:SetScript("OnUpdate", function() if not UnitIsUnit("target", unit) then -- try to read distance via superwow first if superwow_active then - local x1, y1 = UnitPosition("player") - local x2, y2 = UnitPosition(unit) + local x1, y1, z1 = UnitPosition("player") + local x2, y2, z2 = UnitPosition(unit) -- only continue if we got position values - if (x1 and x1 > 0) and (x2 and x2 > 0) then - local distance = ((x2 - x1)^2 + (y2 - y1)^2)^.5 + if x1 and y1 and z1 and x2 and y2 and z2 then + local distance = ((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)^.5 unitdata[unit] = distance < 45 and 1 or 0 this.id = this.id + 1 return