Use shared raid ticker and tidy map hook

This commit is contained in:
Dusk-92
2026-08-30 09:15:20 +02:00
parent f4685c9e01
commit 60670c40d1
2 changed files with 29 additions and 14 deletions
+29 -13
View File
@@ -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
-1
View File
@@ -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"],