continuation of oUF_GPS

This commit is contained in:
Crum
2018-05-31 12:09:08 -05:00
parent e1842c2779
commit 17996e58ca
4 changed files with 28 additions and 26 deletions
+13 -14
View File
@@ -30,7 +30,6 @@ local GetAngle = function(unit1, unit2)
if x1 <= 0 and y1 <= 0 then return nil end
local x2, y2 = GetPlayerMapPosition(unit2)
if x2 <= 0 and y2 <= 0 then return nil end
-- print(pi2, GetPlayerFacing(), y2, y1, x2, x1)
return -pi2 - GetPlayerFacing() - atan2(y2 - y1, x2 - x1)
end
@@ -38,39 +37,39 @@ local minThrottle = 0.02
local numArrows, inRange, unit, GPS
local Update = function(self, elapsed)
if self.elapsed and self.elapsed > (self.throttle or minThrottle) then
numArrows = 0;
numArrows = 0
for _, object in next, _FRAMES do
if object:IsShown() then
GPS = object.GPS;
unit = object.unit;
GPS = object.GPS
unit = object.unit
if unit then
if unit and GPS.outOfRange then
inRange = true;
inRange = CheckInteractDistance(unit, 4)
end
if not unit or not (UnitInParty(unit) or UnitInRaid(unit)) or UnitIsUnit(unit, "player") or not UnitIsConnected(unit) or (GPS.onMouseOver and (GetMouseFocus() ~= object)) or (GPS.outOfRange and inRange) then
GPS:Hide()
else
local angle = GetAngle("player", unit);
local angle = GetAngle("player", unit)
if angle == nil then
GPS:Hide();
GPS:Hide()
else
GPS:Show();
RotateTexture(GPS.Texture, angle);
GPS:Show()
RotateTexture(GPS.Texture, angle)
numArrows = numArrows + 1;
numArrows = numArrows + 1
end
end
else
GPS:Hide();
GPS:Hide()
end
end
end
self.elapsed = 0;
self.throttle = max(minThrottle, 0.005 * numArrows);
self.elapsed = 0
self.throttle = max(minThrottle, 0.005 * numArrows)
else
self.elapsed = (self.elapsed or 0) + tonumber(elapsed);
self.elapsed = (self.elapsed or 0) + elapsed
end
end
+1 -1
View File
@@ -10,7 +10,7 @@ local CreateFrame = CreateFrame
function UF:Construct_GPS(frame)
local gps = CreateFrame("Frame", nil, frame)
gps:SetFrameLevel(frame:GetFrameLevel() + 50)
-- gps:Hide()
gps:Hide()
gps.Texture = gps:CreateTexture("OVERLAY")
gps.Texture:SetTexture([[Interface\AddOns\ElvUI\media\textures\arrow.tga]])
+3
View File
@@ -32,6 +32,7 @@ function UF:Construct_RaidFrames()
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self);
self.GPS = UF:Construct_GPS(self)
self.InfoPanel = UF:Construct_InfoPanel(self)
UF:Update_StatusBars()
UF:Update_FontStrings()
@@ -112,6 +113,8 @@ function UF:Update_RaidFrames(frame, db)
UF:Configure_Portrait(frame)
UF:Configure_GPS(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_RaidRoleIcons(frame)