(fix/Power): fix regression causing stuttery power updates by re-adding FRAME_UPDATE for non-multi-unit units
This change reintroduces FRAME_UPDATE for units not in multiUnitUnits (e.g., player, target) to ensure smooth power updates, similar to UNIT_POWER_FREQUENT in retail. The new logic tho avoids registering other unit events when FRAME_UPDATE is used, improving performance and preventing multiple updates per frame, than before.
This commit is contained in:
@@ -694,6 +694,9 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
|
||||
untriggerCheck = true;
|
||||
end
|
||||
elseif (data.statesParameter == "unit") then
|
||||
if event == "FRAME_UPDATE" and not Private.multiUnitUnits[data.trigger.unit] then
|
||||
arg1 = data.trigger.unit
|
||||
end
|
||||
if arg1 then
|
||||
if Private.multiUnitUnits[data.trigger.unit] then
|
||||
if data.trigger.unit == "group" and IsInRaid() and Private.multiUnitUnits.party[arg1] then
|
||||
|
||||
@@ -2586,7 +2586,7 @@ Private.event_prototypes = {
|
||||
local unit = trigger.unit
|
||||
local result = {}
|
||||
local powerType = trigger.use_powertype and trigger.powertype
|
||||
AddUnitEventForPowerEvents(result, unit, powerType)
|
||||
|
||||
if trigger.powertype == 4 then
|
||||
local _, class = UnitClass("player")
|
||||
AddUnitEventForEvents(result, unit, "UNIT_COMBO_POINTS")
|
||||
@@ -2594,9 +2594,15 @@ Private.event_prototypes = {
|
||||
if class == "DRUID" then
|
||||
AddUnitEventForEvents(result, unit, "UNIT_MODEL_CHANGED")
|
||||
end
|
||||
-- For units not in multiUnitUnits, add FRAME_UPDATE to ensure smooth power updates
|
||||
elseif unit and not Private.multiUnitUnits[unit] then
|
||||
if not result.events then
|
||||
result.events = {}
|
||||
end
|
||||
tinsert(result.events, "FRAME_UPDATE")
|
||||
else
|
||||
AddUnitEventForPowerEvents(result, unit, powerType)
|
||||
end
|
||||
AddUnitEventForEvents(result, unit, "UNIT_DISPLAYPOWER")
|
||||
AddUnitEventForEvents(result, unit, "UNIT_NAME_UPDATE")
|
||||
|
||||
-- The api for spell power costs is not meant to be for other units
|
||||
if trigger.use_showCost and unit == "player" then
|
||||
@@ -2606,11 +2612,16 @@ Private.event_prototypes = {
|
||||
AddUnitEventForEvents(result, unit, "UNIT_SPELLCAST_SUCCEEDED")
|
||||
end
|
||||
|
||||
if trigger.use_ignoreDead or trigger.use_ignoreDisconnected then
|
||||
AddUnitEventForEvents(result, unit, "UNIT_FLAGS")
|
||||
end
|
||||
if trigger.use_inRange then
|
||||
AddUnitEventForEvents(result, unit, "UNIT_IN_RANGE_UPDATE")
|
||||
-- Register shared events unless we're in the FRAME_UPDATE case
|
||||
if not (unit and not Private.multiUnitUnits[unit]) then
|
||||
AddUnitEventForEvents(result, unit, "UNIT_DISPLAYPOWER")
|
||||
AddUnitEventForEvents(result, unit, "UNIT_NAME_UPDATE")
|
||||
if trigger.use_ignoreDead or trigger.use_ignoreDisconnected then
|
||||
AddUnitEventForEvents(result, unit, "UNIT_FLAGS")
|
||||
end
|
||||
if trigger.use_inRange then
|
||||
AddUnitEventForEvents(result, unit, "UNIT_IN_RANGE_UPDATE")
|
||||
end
|
||||
end
|
||||
return result;
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user