mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Replace custom/UnitXP timers with ClassicAPI C_Timer
- ScheduleTimer now wraps C_Timer.After, removing the dedicated timer frame + per-frame OnUpdate loop + timers queue. - Aura-tracking cleanup -> C_Timer.NewTicker(5) (_auraCleanupTicker); drop the UnitXP arm, the named global CleveRoids_AuraTrackingCleanupTimer, and the inline "not hasUnitXP" fallback in OnAuraCastOther. - Libdebuff cleanup -> C_Timer.NewTicker(30) (_cleanupTicker); drop the UnitXP arm and CleveRoids_LibDebuffCleanupTimer. - Shutdown cancels the tickers instead of UnitXP timer disarm. Cleanup now always runs (was gated on hasUnitXP) and no longer depends on UnitXP threaded timers or named global callbacks. Tickers self-guard on isShuttingDown and are cancelled on shutdown.
This commit is contained in:
+6
-22
@@ -786,30 +786,14 @@ function Extension.PLAYER_LOGIN()
|
||||
end
|
||||
end
|
||||
|
||||
-- Utility: Schedule a delayed function call (if not already defined)
|
||||
-- Utility: Schedule a delayed function call via ClassicAPI's C_Timer.
|
||||
if not CleveRoids.ScheduleTimer then
|
||||
local timerFrame = CreateFrame("Frame")
|
||||
local timers = {}
|
||||
|
||||
timerFrame:SetScript("OnUpdate", function()
|
||||
-- Prevent SuperWoW API calls during shutdown (crash prevention)
|
||||
if CleveRoids.isShuttingDown then return end
|
||||
|
||||
local time = GetTime()
|
||||
for i = table.getn(timers), 1, -1 do
|
||||
local timer = timers[i]
|
||||
if time >= timer.time then
|
||||
timer.func()
|
||||
table.remove(timers, i)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
CleveRoids.ScheduleTimer = function(func, delay)
|
||||
table.insert(timers, {
|
||||
func = func,
|
||||
time = GetTime() + delay
|
||||
})
|
||||
C_Timer.After(delay, function()
|
||||
-- Prevent SuperWoW API calls during shutdown (crash prevention)
|
||||
if CleveRoids.isShuttingDown then return end
|
||||
func()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user