From 60670c40d119bd80e881319434a57656e992d5d3 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Sun, 30 Aug 2026 09:15:20 +0200 Subject: [PATCH] Use shared raid ticker and tidy map hook --- mods/raid.lua | 42 +++++++++++++++++++++++++++------------- mods/worldmap-reveal.lua | 1 - 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/mods/raid.lua b/mods/raid.lua index 4dcd96e..3bfa805 100644 --- a/mods/raid.lua +++ b/mods/raid.lua @@ -87,21 +87,10 @@ local UnitFrame_OnUpdate = function() return end - -- Only components that explicitly need frame-by-frame animation run here. + -- Only true frame-by-frame animations run on individual unit frames. for component in pairs(this.onupdate) do component.update(this) end - - -- Shared 250 ms pseudo-event using the elapsed frame time instead of GetTime. - if this.events['FRAME_TICK_250'] then - this.tick250 = (this.tick250 or 0) - (arg1 or 0) - if this.tick250 <= 0 then - this.tick250 = .250 - for _, component in pairs(this.events['FRAME_TICK_250']) do - component.update(this, 'FRAME_TICK_250') - end - end - end end local UnitFrame_OnClick = function() @@ -174,7 +163,6 @@ local CreateUnitFrame = function(parent, i) frame:SetScript("OnClick", UnitFrame_OnClick) frame:SetScript("OnEnter", UnitFrame_OnEnter) frame:SetScript("OnLeave", UnitFrame_OnLeave) - frame:SetScript("OnUpdate", UnitFrame_OnUpdate) frame:RegisterForClicks('LeftButtonUp', 'RightButtonUp') -- base events @@ -204,6 +192,12 @@ local CreateUnitFrame = function(parent, i) end end + if next(frame.onupdate) then + frame:SetScript("OnUpdate", UnitFrame_OnUpdate) + else + frame:SetScript("OnUpdate", nil) + end + -- save frame to parent parent.frames[i] = frame end @@ -608,4 +602,26 @@ module.enable = function(self) -- assign default config raid.cluster.config = module.config end + + do -- shared 250ms component ticker + raid.ticker = CreateFrame("Frame", nil, raid) + raid.ticker:SetScript("OnUpdate", function() + this.elapsed = (this.elapsed or 0) + (arg1 or 0) + if this.elapsed < .250 then return end + this.elapsed = this.elapsed - .250 + + if not raid.cluster.frames then return end + + for _, frame in pairs(raid.cluster.frames) do + if frame:IsVisible() and frame.unitstr and UnitName(frame.unitstr) then + local tickers = frame.events['FRAME_TICK_250'] + if tickers then + for _, component in pairs(tickers) do + component.update(frame, 'FRAME_TICK_250') + end + end + end + end + end) + end end diff --git a/mods/worldmap-reveal.lua b/mods/worldmap-reveal.lua index f855b53..813f900 100644 --- a/mods/worldmap-reveal.lua +++ b/mods/worldmap-reveal.lua @@ -1,7 +1,6 @@ local _G = ShaguTweaks.GetGlobalEnv() local T = ShaguTweaks.T local hooksecurefunc = ShaguTweaks.hooksecurefunc -local hooksecurefunc = hooksecurefunc or ShaguTweaks.hooksecurefunc local module = ShaguTweaks:register({ title = T["Reveal World Map"],