mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-24 00:26:55 +00:00
nameplates: drop redundant name check from plate-reassignment gate
GUID is the unique identity; the name check was leftover from the name-only era and became dead weight once cachedGuid (NAME_PLATE_UNIT_ ADDED) was added alongside it.
This commit is contained in:
+8
-11
@@ -933,18 +933,15 @@ end
|
||||
local name = plate.original.name:GetText()
|
||||
local level = plate.original.level:IsShown() and plate.original.level:GetObjectType() == "FontString" and tonumber(plate.original.level:GetText()) or "??"
|
||||
|
||||
-- reset per-unit cache when the plate is reassigned. Gate on GUID *and*
|
||||
-- name — name alone misses pool reuse between same-named units (e.g. plate
|
||||
-- held a player "Ironforge Guard" and is now reassigned to the NPC by the
|
||||
-- same name), which would leak a stale "PLAYER" hint into GetUnitInfo.
|
||||
-- Wipe the whole cache table: the PERF gates below ("only update X when
|
||||
-- X changed") would otherwise skip bar/color/text updates when the new
|
||||
-- unit happens to share a cached value with the previous occupant
|
||||
-- (e.g., both at 60% HP percentage on plate pool reuse → bar stays at
|
||||
-- the old fill until the new mob actually changes HP).
|
||||
if plate.cache.name ~= name or plate.cache.guid ~= plate.cachedGuid then
|
||||
-- Reset per-unit cache on plate pool reuse. GUID alone is the identity —
|
||||
-- a unit can't change its name without changing GUID, and NAME_PLATE_UNIT_
|
||||
-- ADDED writes plate.cachedGuid before this fires. Wipe the whole table:
|
||||
-- the PERF gates below ("only update X when X changed") would otherwise
|
||||
-- skip bar/color/text updates when the new unit happens to share a
|
||||
-- cached value with the previous occupant (e.g., both at 60% HP
|
||||
-- percentage → bar stays at the old fill until the new mob's HP moves).
|
||||
if plate.cache.guid ~= plate.cachedGuid then
|
||||
table.wipe(plate.cache)
|
||||
plate.cache.name = name
|
||||
plate.cache.guid = plate.cachedGuid
|
||||
plate.cdCache = nil -- new unit, reset spell-keyed timer cache
|
||||
plate.name:SetText(GetNameString(name))
|
||||
|
||||
Reference in New Issue
Block a user