From 98071ca86ce7f4950e6ef59baccfd60dc751df0e Mon Sep 17 00:00:00 2001 From: shagu Date: Wed, 30 Dec 2020 17:37:45 +0100 Subject: [PATCH] unitframes: wait for stable unit before updating --- api/unitframes.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/unitframes.lua b/api/unitframes.lua index 8378e941..b2ecccc0 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -925,6 +925,20 @@ function pfUI.uf.OnUpdate() local unitstr = this.label .. this.id this.lastTick = GetTime() + (this.tick or .2) + + -- target target has a huge delay, make sure to not tick during range checks + -- by waiting for a stable name over three ticks otherwise aborting the update. + if this.label == "targettarget" or this.label == "targettargettarget" then + local name = UnitName(this.label) + if name ~= this.namebuf1 then + this.namebuf1 = name + return + elseif name ~= this.namebuf2 then + this.namebuf2 = name + return + end + end + pfUI.uf:RefreshUnitState(this) pfUI.uf:RefreshIndicators(this)