Throttles

Added throttle for player castbar, player frame and Raidframes
This commit is contained in:
Meow
2026-01-10 14:31:47 +01:00
parent 9fc161df21
commit 7f93ebefaf
3 changed files with 17 additions and 2 deletions
+5
View File
@@ -66,7 +66,12 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
cb.bar.lag:SetPoint("BOTTOMRIGHT", cb.bar, "BOTTOMRIGHT", 0, 0)
cb.bar.lag:SetTexture(1,.2,.2,.2)
-- OnUpdate script with throttle for performance optimization
cb:SetScript("OnUpdate", function()
-- Throttle for performance
if (this.tick or 0) > GetTime() then return end
this.tick = GetTime() + 0.025 -- ~60 FPS for smooth castbar
if this.drag and this.drag:IsShown() then
this:SetAlpha(1)
return
+11 -1
View File
@@ -11,6 +11,16 @@ pfUI:RegisterModule("player", "vanilla:tbc", function ()
pfUI.uf.player:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", -75, 125)
UpdateMovable(pfUI.uf.player)
-- Add throttle to player frame OnUpdate
if pfUI.uf.player:GetScript("OnUpdate") then
local originalOnUpdate = pfUI.uf.player:GetScript("OnUpdate")
pfUI.uf.player:SetScript("OnUpdate", function()
if (this.tick or 0) > GetTime() then return end
this.tick = GetTime() + 0.1
originalOnUpdate()
end)
end
-- Replace default's RESET_INSTANCES button with an always working one
UnitPopupButtons["RESET_INSTANCES_FIX"] = { text = RESET_INSTANCES, dist = 0 }
for id, text in pairs(UnitPopupMenus["SELF"]) do
@@ -25,4 +35,4 @@ pfUI:RegisterModule("player", "vanilla:tbc", function ()
StaticPopup_Show("CONFIRM_RESET_INSTANCES")
end
end)
end)
end)
+1 -1
View File
@@ -89,7 +89,7 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
pfUI.uf.raid:SetScript("OnUpdate", function()
-- Throttle raid roster updates to 5 FPS
if (this.tick or 0) > GetTime() then return end
this.tick = GetTime() + 0.2
this.tick = GetTime() + 0.25
-- don't proceed without raid or during combat
if not UnitInRaid("player") or (InCombatLockdown and InCombatLockdown()) then return end