From a6c5020873b455c239794e9c2c7d6d908873ac29 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Sun, 6 Mar 2011 20:46:52 +0000 Subject: [PATCH] Throttle archoaeology distance checks --- sources/ArchaeologyDigSites.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sources/ArchaeologyDigSites.lua b/sources/ArchaeologyDigSites.lua index fb6a713..770c471 100644 --- a/sources/ArchaeologyDigSites.lua +++ b/sources/ArchaeologyDigSites.lua @@ -18,7 +18,6 @@ eventFrame:RegisterEvent("ARTIFACT_DIG_SITE_UPDATED") -- Creates waypoints for each of the dig sites that can be found -- on the current continent - local waypoints = {} local function UpdateDigSites() if not addon.db.profile.archaeologyDigSitesSource then @@ -71,9 +70,18 @@ eventFrame:SetScript("OnEvent", function(self, event, ...) end) local throttle = 2.0 +local counter = 0 eventFrame:SetScript("OnUpdate", function(self, elapsed) + counter = counter + elapsed + if counter < throttle then + return + else + counter = counter - throttle + end + local min = math.huge local closest + for key, waypoint in pairs(waypoints) do local distance, angle = addon:GetVectorFromCurrent(unpack(waypoint)) if distance and distance < min then -- 1.7.9.5