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
+1 -1
View File
@@ -271,7 +271,7 @@ function GetPlayerFacing()
local obj = Minimap local obj = Minimap
for i = 1, obj:GetNumChildren() do for i = 1, obj:GetNumChildren() do
local child = select(i, obj:GetChildren()) local child = select(i, obj:GetChildren())
if child and child.GetModel and child:GetModel() == "interface\\minimap\\minimaparrow.m2" then if child and child.GetModel and child:GetModel() == "Interface\\Minimap\\MinimapArrow" then
arrow = child arrow = child
break break
end end
+13 -14
View File
@@ -30,7 +30,6 @@ local GetAngle = function(unit1, unit2)
if x1 <= 0 and y1 <= 0 then return nil end if x1 <= 0 and y1 <= 0 then return nil end
local x2, y2 = GetPlayerMapPosition(unit2) local x2, y2 = GetPlayerMapPosition(unit2)
if x2 <= 0 and y2 <= 0 then return nil end 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) return -pi2 - GetPlayerFacing() - atan2(y2 - y1, x2 - x1)
end end
@@ -38,39 +37,39 @@ local minThrottle = 0.02
local numArrows, inRange, unit, GPS local numArrows, inRange, unit, GPS
local Update = function(self, elapsed) local Update = function(self, elapsed)
if self.elapsed and self.elapsed > (self.throttle or minThrottle) then if self.elapsed and self.elapsed > (self.throttle or minThrottle) then
numArrows = 0; numArrows = 0
for _, object in next, _FRAMES do for _, object in next, _FRAMES do
if object:IsShown() then if object:IsShown() then
GPS = object.GPS; GPS = object.GPS
unit = object.unit; unit = object.unit
if unit then if unit then
if unit and GPS.outOfRange then if unit and GPS.outOfRange then
inRange = true; inRange = CheckInteractDistance(unit, 4)
end 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 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() GPS:Hide()
else else
local angle = GetAngle("player", unit); local angle = GetAngle("player", unit)
if angle == nil then if angle == nil then
GPS:Hide(); GPS:Hide()
else else
GPS:Show(); GPS:Show()
RotateTexture(GPS.Texture, angle); RotateTexture(GPS.Texture, angle)
numArrows = numArrows + 1; numArrows = numArrows + 1
end end
end end
else else
GPS:Hide(); GPS:Hide()
end end
end end
end end
self.elapsed = 0; self.elapsed = 0
self.throttle = max(minThrottle, 0.005 * numArrows); self.throttle = max(minThrottle, 0.005 * numArrows)
else else
self.elapsed = (self.elapsed or 0) + tonumber(elapsed); self.elapsed = (self.elapsed or 0) + elapsed
end end
end end
+1 -1
View File
@@ -10,7 +10,7 @@ local CreateFrame = CreateFrame
function UF:Construct_GPS(frame) function UF:Construct_GPS(frame)
local gps = CreateFrame("Frame", nil, frame) local gps = CreateFrame("Frame", nil, frame)
gps:SetFrameLevel(frame:GetFrameLevel() + 50) gps:SetFrameLevel(frame:GetFrameLevel() + 50)
-- gps:Hide() gps:Hide()
gps.Texture = gps:CreateTexture("OVERLAY") gps.Texture = gps:CreateTexture("OVERLAY")
gps.Texture:SetTexture([[Interface\AddOns\ElvUI\media\textures\arrow.tga]]) 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.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self); self.RaidTargetIndicator = UF:Construct_RaidIcon(self);
self.GPS = UF:Construct_GPS(self)
self.InfoPanel = UF:Construct_InfoPanel(self) self.InfoPanel = UF:Construct_InfoPanel(self)
UF:Update_StatusBars() UF:Update_StatusBars()
UF:Update_FontStrings() UF:Update_FontStrings()
@@ -112,6 +113,8 @@ function UF:Update_RaidFrames(frame, db)
UF:Configure_Portrait(frame) UF:Configure_Portrait(frame)
UF:Configure_GPS(frame)
UF:Configure_RaidIcon(frame) UF:Configure_RaidIcon(frame)
UF:Configure_RaidRoleIcons(frame) UF:Configure_RaidRoleIcons(frame)