From 7f93ebefafc44318f34e5d37a172d7423ac02ef2 Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Sat, 10 Jan 2026 14:31:47 +0100 Subject: [PATCH] Throttles Added throttle for player castbar, player frame and Raidframes --- modules/castbar.lua | 5 +++++ modules/player.lua | 12 +++++++++++- modules/raid.lua | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/castbar.lua b/modules/castbar.lua index ea6d33ae..1030c01c 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -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 diff --git a/modules/player.lua b/modules/player.lua index 59979fff..0c1480b5 100644 --- a/modules/player.lua +++ b/modules/player.lua @@ -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) \ No newline at end of file diff --git a/modules/raid.lua b/modules/raid.lua index 6c5f4c6f..69f271cd 100644 --- a/modules/raid.lua +++ b/modules/raid.lua @@ -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