ESO Lua File v100010

ingame/compass/compass.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
Compass = ZO_Object:Subclass()
function Compass:New(...)
    local compass = ZO_Object.New(self)
    compass:Initialize(...)
    return compass
end
local function IsPlayerInsideJournalQuestConditionGoalArea(journalIndex, stepIndex, conditionIndex)
    journalIndex = journalIndex - 1
    stepIndex = stepIndex - 1
    conditionIndex = conditionIndex - 1
    return IsPlayerInsidePinArea(MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION, journalIndex, stepIndex, conditionIndex)
        or IsPlayerInsidePinArea(MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION, journalIndex, stepIndex, conditionIndex)
        or IsPlayerInsidePinArea(MAP_PIN_TYPE_TRACKED_QUEST_CONDITION, journalIndex, stepIndex, conditionIndex)
        or IsPlayerInsidePinArea(MAP_PIN_TYPE_TRACKED_QUEST_OPTIONAL_CONDITION, journalIndex, stepIndex, conditionIndex)
end
local function IsQuestVisible(journalIndex)
    local visibilitySetting = tonumber(GetSetting(SETTING_TYPE_UI, UI_SETTING_COMPASS_ACTIVE_QUESTS))
    if visibilitySetting == COMPASS_ACTIVE_QUESTS_CHOICE_ON then 
        return true
    elseif visibilitySetting == COMPASS_ACTIVE_QUESTS_CHOICE_OFF then 
        return false
    else
        return GetTrackedIsAssisted(TRACK_TYPE_QUEST, journalIndex)
    end
end
local function ShouldShowQuestArea(journalIndex, stepIndex, conditionIndex)
    if IsPlayerInsideJournalQuestConditionGoalArea(journalIndex, stepIndex, conditionIndex) then
        return IsQuestVisible(journalIndex)
    else
        return false
    end
end
function Compass:Initialize(control)
    self.control = control
    self.container = control:GetNamedChild("Container")
    self.areaOverride = control:GetNamedChild("AreaOverride")
    self.areaOverrideLabel = self.areaOverride:GetNamedChild("Label")
    self.areaOverrideAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("CompassAreaOverrideLabelAnimation", self.areaOverride)
    self.areaOverrideAnimation:SetHandler("OnStop", function()
        self.currentOverrideJournalIndex = nil
        self.currentOverrideStepIndex = nil
        self.currentOverrideConditionIndex = nil
        while self.areaOverrideQueue do
            local nextOverride = table.remove(self.areaOverrideQueue, 1)
            if #self.areaOverrideQueue == 0 then
                self.areaOverrideQueue = nil
            end
            if ShouldShowQuestArea(nextOverride.journalIndex, nextOverride.stepIndex, nextOverride.conditionIndex) then
                self:PlayAreaOverrideAnimation(nextOverride.journalIndex, nextOverride.stepIndex, nextOverride.conditionIndex)
                break
            end
        end
        self.areaOverride:SetWidth(0)
        self.areaOverride:SetAlpha(1)
    end)
    self.container:SetHandler("OnUpdate", function() self:OnUpdate() end)
    self.nextLabelUpdateTime = 0
    self:OnGamepadPreferredModeChanged() -- Setup initial visual style based on current mode.
    self.control:RegisterForEvent(EVENT_GAMEPAD_PREFERRED_MODE_CHANGED, function() self:OnGamepadPreferredModeChanged() end)
end
function Compass:InitializeCenterOveredPins()
    self.centerOverPinLabel = self.control:GetNamedChild("CenterOverPinLabel")
    self.centerOverPinLabelAnimation = ANIMATION_MANAGER:CreateTimelineFromVirtual("CompassCenterOverPinAnimation", self.centerOverPinLabel)
end
function Compass:InitializePoiPins()
    local function OnPoiAnimationStopped(animation, control)
        self.poiAnimationPool:ReleaseObject(animation:GetTimeline().key)
        control:ClearAnchors()
        control:SetHidden(true)
    end
    local function CreatePoiAnimationTimeline()
        local timeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("CompassPoiPinAnimationOut")
        timeline:GetFirstAnimation():SetHandler("OnStop", OnPoiAnimationStopped)
        return timeline
    end
    self.poiAnimationPool = ZO_ObjectPool:New(CreatePoiAnimationTimeline, function() end)
    self.control:RegisterForEvent(EVENT_ZONE_CHANGED, function() self:OnZoneChanged() end)
    self.control:RegisterForEvent(EVENT_QUEST_COMPLETE, function() self:OnZoneChanged() end)
end
local function ApplyTemplateToAreaTexture(texture, template)
    ApplyTemplateToControl(texture, template)
end
function Compass:InitializeQuestPins()
    local function ResetAreaTexture(areaTexture)
        areaTexture:SetHidden(true)
        areaTexture:ClearAnchors()
    end
    local areaTexturePinPool
    local function OnAreaTextureInOnStop(animationOut)
        areaTexturePinPool:ReleaseObject(animationOut.areaTexture.key)
    end
    
    local function CreateAreaTexture(objectPool)
        local areaTexture = ZO_ObjectPool_CreateControl("ZO_CompassAreaTexture", objectPool, self.container)
        areaTexture.animationIn = ANIMATION_MANAGER:CreateTimelineFromVirtual("CompassAreaTextureAnimationIn")
        areaTexture.animationIn:GetAnimation(1):SetAnimatedControl(areaTexture.left)
        areaTexture.animationIn:GetAnimation(2):SetAnimatedControl(areaTexture.right)
        areaTexture.animationIn:GetAnimation(3):SetAnimatedControl(areaTexture.center)
        for i=4, areaTexture.animationIn:GetNumAnimations() do
            areaTexture.animationIn:GetAnimation(i):SetAnimatedControl(areaTexture)
        end
        areaTexture.animationOut = ANIMATION_MANAGER:CreateTimelineFromVirtual("CompassAreaTextureAnimationOut", areaTexture)
        areaTexture.animationOut:SetHandler("OnStop", OnAreaTextureInOnStop)
        areaTexture.animationOut.areaTexture = areaTexture
        return areaTexture
    end
    
    areaTexturePinPool = ZO_ObjectPool:New(CreateAreaTexture, ResetAreaTexture)
    local function OnAreaAnimationStarted(animationTimeline)
        local pin = animationTimeline:GetFirstAnimation():GetAnimatedControl()
        animationTimeline.pin = pin
        local areaTexture, key = areaTexturePinPool:AcquireObject()
        ApplyTemplateToAreaTexture(areaTexture, IsInGamepadPreferredMode() and "ZO_CompassAreaTexture_Gamepad_Template" or "ZO_CompassAreaTexture_Keyboard_Template")
        areaTexture.key = key
        animationTimeline.areaTexture = areaTexture
        areaTexture.pin = pin
        if self.currentlyAnimatingAreaPinType == MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION 
                or self.currentlyAnimatingAreaPinType == MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION 
                or self.currentlyAnimatingAreaPinType == MAP_PIN_TYPE_ASSISTED_QUEST_ENDING then
            pin:SetTexture("EsoUI/Art/Compass/quest_icon_assisted.dds")
            areaTexture.left:SetTexture("EsoUI/Art/Compass/areapin2frame_ends.dds")
            areaTexture.right:SetTexture("EsoUI/Art/Compass/areapin2frame_ends.dds")
            areaTexture.center:SetTexture("EsoUI/Art/Compass/area2frameAnim_centers.dds")
        else
            pin:SetTexture("EsoUI/Art/Compass/quest_icon.dds")
            areaTexture.left:SetTexture("EsoUI/Art/Compass/area2frameAnim_standard_endcap.dds")
            areaTexture.right:SetTexture("EsoUI/Art/Compass/area2frameAnim_standard_endcap.dds")
            areaTexture.center:SetTexture("EsoUI/Art/Compass/area2frameAnim_standard_center.dds")
        end
        areaTexture:SetAlpha(self.refreshingJournalIndex and 1 or pin:GetAlpha())
        areaTexture:SetHidden(false)
        areaTexture.animationIn:PlayFromStart(self.refreshingJournalIndex and 350 or 0)
    end
    local function OnAreaAnimationStopped(animationTimeline)
        self.areaAnimationPool:ReleaseObject(animationTimeline.key)
        animationTimeline.areaTexture.animationIn:Stop()
        animationTimeline.areaTexture.animationOut:PlayFromStart()
    end
    local function CreateAreaAnimationTimeline()
        local timeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("CompassAreaPinAnimationOut")
        timeline.owner = self
        timeline:SetHandler("OnPlay", OnAreaAnimationStarted)
        timeline:SetHandler("OnStop", OnAreaAnimationStopped)
        return timeline
    end
    self.areaAnimationPool = ZO_ObjectPool:New(CreateAreaAnimationTimeline, function() end)
    local function OnQuestAreaGoalStateChanged(journalIndex, stepIndex, conditionIndex, playerIsInside)
        if playerIsInside and IsQuestVisible(journalIndex) then
            self:PlayAreaPinOutAnimation(journalIndex, stepIndex, conditionIndex)
        else
            self:StopAreaPinOutAnimation(journalIndex, stepIndex, conditionIndex)
            if self.areaOverrideQueue then
                for i=#self.areaOverrideQueue, 1, -1 do
                    local nextOverride = self.areaOverrideQueue[i]
                    if nextOverride.journalIndex == journalIndex and nextOverride.stepIndex == stepIndex and nextOverride.conditionIndex == conditionIndex then
                        table.remove(self.areaOverrideQueue, i)
                        if #self.areaOverrideQueue == 0 then
                            self.areaOverrideQueue = nil
                        end
                        break
                    end
                end
            end
        end
    end
    local function OnPlayerInPinAreaChanged(eventCode, pinType, param1, param2, param3, playerIsInside)
        if pinType == MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION or pinType == MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION or pinType == MAP_PIN_TYPE_TRACKED_QUEST_CONDITION or pinType == MAP_PIN_TYPE_TRACKED_QUEST_OPTIONAL_CONDITION then
            OnQuestAreaGoalStateChanged(param1 + 1, param2 + 1, param3 + 1, playerIsInside)
        end
    end
    self.control:RegisterForEvent(EVENT_PLAYER_IN_PIN_AREA_CHANGED, OnPlayerInPinAreaChanged)
    local function OnQuestRemovedOrChanged(eventCode, journalIndex)
        self:RemoveAreaPinsByQuest(journalIndex)
    end
    self.control:RegisterForEvent(EVENT_QUEST_ADVANCED, OnQuestRemovedOrChanged)
    self.control:RegisterForEvent(EVENT_QUEST_REMOVED, OnQuestRemovedOrChanged)
    local function OnPlayerActivated()
        self:PerformFullAreaQuestUpdate()
        COMPASS_FRAME:SetCompassReady(true)
        self:OnZoneChanged()
    end
    self.control:RegisterForEvent(EVENT_PLAYER_ACTIVATED, OnPlayerActivated)
    self.control:RegisterForEvent(EVENT_SCREEN_RESIZED, function() self:PerformFullAreaQuestUpdate() end)
    QUEST_TRACKER:RegisterCallback("QuestTrackerAssistStateChanged", function(assisted, unassisted) self:PerformFullAreaQuestUpdate() end)
    QUEST_TRACKER:RegisterCallback("QuestTrackerRefreshedMapPins", function() self.refreshingJournalIndex = true self:PerformFullAreaQuestUpdate() self.refreshingJournalIndex = false end)
end
function Compass:SetCardinalDirections(font)
    self.container:SetCardinalDirection(GetString(SI_COMPASS_NORTH_ABBREVIATION), font, CARDINAL_DIRECTION_NORTH)
    self.container:SetCardinalDirection(GetString(SI_COMPASS_EAST_ABBREVIATION), font, CARDINAL_DIRECTION_EAST)
    self.container:SetCardinalDirection(GetString(SI_COMPASS_WEST_ABBREVIATION), font, CARDINAL_DIRECTION_WEST)
    self.container:SetCardinalDirection(GetString(SI_COMPASS_SOUTH_ABBREVIATION), font, CARDINAL_DIRECTION_SOUTH)
end
function Compass:ApplyKeyboardStyle()
    ApplyTemplateToControl(self.control, "ZO_Compass_Keyboard_Template")
    self:ApplyTemplateToAreaTextures("ZO_CompassAreaTexture_Keyboard_Template")
    self:SetCardinalDirections("ZoFontHeader4")
end
function Compass:ApplyGamepadStyle()
    ApplyTemplateToControl(self.control, "ZO_Compass_Gamepad_Template")
    self:ApplyTemplateToAreaTextures("ZO_CompassAreaTexture_Gamepad_Template")
    self:SetCardinalDirections("ZoFontGamepadBold34")
end
function Compass:OnGamepadPreferredModeChanged()
    if IsInGamepadPreferredMode() then
        self:ApplyGamepadStyle()
    else
        self:ApplyKeyboardStyle()
    end
end
function Compass:PerformFullAreaQuestUpdate()
    for journalIndex = 1, MAX_JOURNAL_QUESTS  do
        if IsValidQuestIndex(journalIndex) then
            for stepIndex = QUEST_MAIN_STEP_INDEX, GetJournalQuestNumSteps(journalIndex) do
                for conditionIndex = 1, GetJournalQuestNumConditions(journalIndex, stepIndex) do
                    if ShouldShowQuestArea(journalIndex, stepIndex, conditionIndex) then
                        self:PlayAreaPinOutAnimation(journalIndex, stepIndex, conditionIndex)
                    else
                        self:StopAreaPinOutAnimation(journalIndex, stepIndex, conditionIndex)
                    end
                end
            end
        end
    end
end
function Compass:UpdateInsidePoiState()
    self.zoneIndex, self.poiIndex = GetCurrentSubZonePOIIndices()
end
function Compass:IsInsidePoi()
    return self.zoneIndex ~= nil
end
function Compass:OnZoneChanged()
    local isInPoi = self:IsInsidePoi()
    if isInPoi then
        self:PlayPoiPinOutAnimation()
    end
end
function Compass:TryPlayingAnimationOnSinglePoi(zoneIndex, poiIndex, pinType)
    local animation, key = self.poiAnimationPool:AcquireObject()
    if not StartMapPinAnimation(animation, PIN_ANIMATION_TARGET_MAP, CT_COMPASS, pinType, zoneIndex - 1, poiIndex - 1) then
        self.poiAnimationPool:ReleaseObject(key)
    else
        animation.key = key
    end
end
function Compass:PlayPoiPinOutAnimation()
    self:TryPlayingAnimationOnSinglePoi(self.zoneIndex, self.poiIndex, MAP_PIN_TYPE_POI_SEEN)
    self:TryPlayingAnimationOnSinglePoi(self.zoneIndex, self.poiIndex, MAP_PIN_TYPE_POI_COMPLETE)
end
local IGNORE_BREADCRUMBS = true
function Compass:TryPlayingAnimationOnAreaPin(journalIndex, stepIndex, conditionIndex, pinType)
    local animation, key = self.areaAnimationPool:AcquireObject()
    self.currentlyAnimatingAreaPinType = pinType
    if not StartMapPinAnimation(animation, PIN_ANIMATION_TARGET_MAP, CT_COMPASS, pinType, journalIndex - 1, stepIndex - 1, conditionIndex - 1, nil, IGNORE_BREADCRUMBS) then
        self.areaAnimationPool:ReleaseObject(key)
        self.currentlyAnimatingAreaPinType = nil
        return false
    else
        animation.key = key
        self:StoreAreaPinAnimation(journalIndex, stepIndex, conditionIndex, animation)
        self.currentlyAnimatingAreaPinType = nil
        return true
    end
end
function Compass:PlayAreaOverrideAnimation(journalIndex, stepIndex, conditionIndex)
    local conditionText = GetJournalQuestConditionInfo(journalIndex, stepIndex, conditionIndex)
    self.areaOverrideLabel:SetText(conditionText)
    local desiredWidth = self.areaOverrideLabel:GetTextWidth() + 10
    local sizeAnimation = self.areaOverrideAnimation:GetFirstAnimation()
    sizeAnimation:SetStartAndEndWidth(0, desiredWidth)
    self.areaOverrideAnimation:PlayFromStart()
    self.currentOverrideJournalIndex = journalIndex
    self.currentOverrideStepIndex = stepIndex
    self.currentOverrideConditionIndex = conditionIndex
end
function Compass:PlayAreaPinOutAnimation(journalIndex, stepIndex, conditionIndex)
    local playedAnyAnimation = self:TryPlayingAnimationOnAreaPin(journalIndex, stepIndex, conditionIndex, MAP_PIN_TYPE_ASSISTED_QUEST_CONDITION)
    playedAnyAnimation = self:TryPlayingAnimationOnAreaPin(journalIndex, stepIndex, conditionIndex, MAP_PIN_TYPE_ASSISTED_QUEST_OPTIONAL_CONDITION) or playedAnyAnimation
    playedAnyAnimation = self:TryPlayingAnimationOnAreaPin(journalIndex, stepIndex, conditionIndex, MAP_PIN_TYPE_TRACKED_QUEST_CONDITION) or playedAnyAnimation
    playedAnyAnimation = self:TryPlayingAnimationOnAreaPin(journalIndex, stepIndex, conditionIndex, MAP_PIN_TYPE_TRACKED_QUEST_OPTIONAL_CONDITION) or playedAnyAnimation
    if not self.refreshingJournalIndex and playedAnyAnimation and (self.currentOverrideJournalIndex ~= journalIndex or self.currentOverrideStepIndex ~= stepIndex or self.currentOverrideConditionIndex ~= conditionIndex) then
        if self.areaOverrideQueue then
            for i, nextOverride in ipairs(self.areaOverrideQueue) do
                if nextOverride.journalIndex == journalIndex and nextOverride.stepIndex == stepIndex and nextOverride.conditionIndex == conditionIndex then
                    return -- already queued
                end
            end
        end
        if self.areaOverrideAnimation:IsPlaying() then
            if not self.areaOverrideQueue then
                self.areaOverrideQueue = {}
            end
            self.areaOverrideQueue[#self.areaOverrideQueue + 1] = { journalIndex = journalIndex, stepIndex = stepIndex, conditionIndex = conditionIndex } 
        else
            self:PlayAreaOverrideAnimation(journalIndex, stepIndex, conditionIndex)
        end
    end
end
function Compass:StopAreaPinOutAnimation(journalIndex, stepIndex, conditionIndex)
    local animation = self:GetAreaPinAnimationFromStorage(journalIndex, stepIndex, conditionIndex)
    if animation then
        animation:Stop()
        self:RemoveAreaPinAnimationFromStorage(journalIndex, stepIndex, conditionIndex)
    end
end
do
    local function CreatePath(t, ...)
        local current = t
        for i=1, select("#", ...) do
            local key = select(i, ...)
            if not current[key] then
                current[key] = {}
            end
            current = current[key]
        end
        return current
    end
    function Compass:StoreAreaPinAnimation(journalIndex, stepIndex, conditionIndex, animation)
        local path = CreatePath(self, "areaPinAnimations", journalIndex, stepIndex)
        path[conditionIndex] = animation
    end
    function Compass:GetAreaPinAnimationFromStorage(journalIndex, stepIndex, conditionIndex)
        if self.areaPinAnimations then
            if self.areaPinAnimations[journalIndex] then
                if self.areaPinAnimations[journalIndex][stepIndex] then
                    return self.areaPinAnimations[journalIndex][stepIndex][conditionIndex]
                end
            end
        end
    end
    function Compass:RemoveAreaPinAnimationFromStorage(journalIndex, stepIndex, conditionIndex)
        self.areaPinAnimations[journalIndex][stepIndex][conditionIndex] = nil
    end
    function Compass:RemoveAreaPinsByQuest(journalIndex)
        if self.areaPinAnimations and self.areaPinAnimations[journalIndex] then
            for i, step in ipairs(self.areaPinAnimations[journalIndex]) do
                for j, animation in ipairs(step) do
                    animation:Stop()
                end
            end
            self.areaPinAnimations[journalIndex] = nil
        end
    end
    function Compass:ApplyTemplateToAreaTextures(template)
        if self.areaPinAnimations then
            for _, journalEntry in pairs(self.areaPinAnimations) do
                for _, stepEntry in pairs(journalEntry) do
                    for _, animation in pairs(stepEntry) do
                        ApplyTemplateToAreaTexture(animation.areaTexture, template)
                    end
                end
            end
        end
    end
end
local function CalculateLayerInformedDistance(drawLayer, drawLevel)
    return (1.0 - (drawLevel / 0xFFFFFFFF)) - drawLayer
end 
do
    local pinTypeToFormatId =
    {
        [MAP_PIN_TYPE_POI_SEEN] = SI_COMPASS_LOCATION_NAME_FORMAT,
        [MAP_PIN_TYPE_POI_COMPLETE] = SI_COMPASS_LOCATION_NAME_FORMAT,
    }
    local TIME_BETWEEN_LABEL_UPDATES_MS = 100
    function Compass:OnUpdate()
        if self.areaOverrideAnimation:IsPlaying() then
            self.centerOverPinLabelAnimation:PlayBackward()
        elseif not self.centerOverPinLabelAnimation:IsPlaying() or not self.centerOverPinLabelAnimation:IsPlayingBackward() then
            local now = GetFrameTimeMilliseconds()
            if now < self.nextLabelUpdateTime then
                return
            end
            self.nextLabelUpdateTime = now + TIME_BETWEEN_LABEL_UPDATES_MS
            local bestPinDescription
            local bestLayerInformedDistance
            local bestPinType
            if not (DoesUnitExist("boss1") or DoesUnitExist("boss2")) then
                for i=1, self.container:GetNumCenterOveredPins() do
                    local description, pinType, distance, drawLayer, drawLevel, isSupressed = self.container:GetCenterOveredPinInfo(i)
                    if not isSupressed and description ~= "" then
                        local layerInformedDistance = CalculateLayerInformedDistance(drawLayer, drawLevel)
                        if not bestLayerInformedDistance or layerInformedDistance < bestLayerInformedDistance then
                            bestLayerInformedDistance = layerInformedDistance
                            bestPinDescription = description
                            bestPinType = pinType
                        end
                    end
                end
            end
            if bestPinDescription then
                local formatId = pinTypeToFormatId[bestPinType]
                if(formatId) then
                    self.centerOverPinLabel:SetText(zo_strformat(formatId, bestPinDescription))
                else
                    self.centerOverPinLabel:SetText(bestPinDescription)
                end
                self.centerOverPinLabelAnimation:PlayForward()
            else
                self.centerOverPinLabelAnimation:PlayBackward()
            end
        end
    end
end
    COMPASS = Compass:New(control)
end
function ZO_CompassPoiPinAnimationOutUpdate(animation, progress, control)
    COMPASS:CompassPoiPinAnimationOutUpdate(animation, progress, control)
end