Files
pfUI/modules/group.lua
T
Brues a9542bd467 Follow target-of-target frames with UNIT_TARGET
A frame whose unit is another unit's target (targettarget,
targettargettarget, pettarget, focustarget, partyNtarget) has no token
that unit events name, so it polled: bars every 0.2s, a full aura and
portrait rescan every second, and a GUID compare to notice swaps.

Such a frame now registers its unit events by the unit's GUID, which
every unit event also fires with, and UNIT_TARGET by the GUID of every
link of its chain. A link retargeting re-points the frame at once and
queues one full refresh; the ticks are gone. The 0.2s visibility timer
stays for them, since nothing reports a unit going out of sight.

Nameplates register UNIT_TARGET on their own token, so a mob turning to
someone else recolours its combat state immediately instead of after
the colour cache and data tick run out.

Drop pfScanActive and the namebuf delay: both guarded against the old
target-swapping range scan, which no longer exists. focus.lua's
instantRefresh was never read.
2026-10-31 06:27:21 -05:00

63 lines
2.3 KiB
Lua

pfUI:RegisterModule("group", function ()
-- do not go further on disabled UFs
if C.unitframes.disable == "1" then return end
-- hide blizzard group frames
local frame
for i=1, 4 do
frame = _G[string.format("PartyMemberFrame%d", i)]
if frame then
frame:Hide()
frame:UnregisterAllEvents()
frame.Show = function () return end
end
end
pfUI.uf.group = {}
function pfUI.uf.group:UpdateConfig()
local startid = C.unitframes.selfingroup == "1" and 0 or 1
local spacing = C.unitframes.group.pspace
local rawborder, default_border = GetBorderSize("unitframes")
for i=0, 4 do
local active = i >= 1 or startid == 0
if active then
pfUI.uf.group[i] = pfUI.uf.group[i] or pfUI.uf:CreateUnitFrame("Party", i, C.unitframes.group)
pfUI.uf.group[i]:UpdateFrameSize()
pfUI.uf.group[i]:SetPoint("TOPLEFT", 5, -5 - ((i-startid)*75))
pfUI.uf.group[i]:UpdateConfig()
UpdateMovable(pfUI.uf.group[i])
elseif pfUI.uf.group[i] then
pfUI.uf.group[i]:UpdateConfig()
RemoveMovable(pfUI.uf.group[i])
end
if C.unitframes.grouptarget.visible == "1" and active then
pfUI.uf.group[i].target = pfUI.uf.group[i].target or pfUI.uf:CreateUnitFrame("Party" .. i .. "Target", nil, C.unitframes.grouptarget)
pfUI.uf.group[i].target:UpdateFrameSize()
pfUI.uf.group[i].target:SetPoint("TOPLEFT", pfUI.uf.group[i], "TOPRIGHT", 3*default_border, 0)
pfUI.uf.group[i].target:UpdateConfig()
UpdateMovable(pfUI.uf.group[i].target)
elseif pfUI.uf.group[i] and pfUI.uf.group[i].target then
pfUI.uf.group[i].target:UpdateConfig()
RemoveMovable(pfUI.uf.group[i].target)
end
if C.unitframes.grouppet.visible == "1" and active then
pfUI.uf.group[i].pet = pfUI.uf.group[i].pet or pfUI.uf:CreateUnitFrame("PartyPet", i, C.unitframes.grouppet, 0.5)
pfUI.uf.group[i].pet:UpdateFrameSize()
pfUI.uf.group[i].pet:SetPoint("BOTTOMLEFT", pfUI.uf.group[i], "BOTTOMRIGHT", 3*default_border, -default_border)
pfUI.uf.group[i].pet:UpdateConfig()
UpdateMovable(pfUI.uf.group[i].pet)
elseif pfUI.uf.group[i] and pfUI.uf.group[i].pet then
pfUI.uf.group[i].pet:UpdateConfig()
RemoveMovable(pfUI.uf.group[i].pet)
end
end
end
pfUI.uf.group:UpdateConfig()
end)