In the Live version of my addon ConsolePort, I'm using a nameplate cursor that deviously hacks the nameplates by caching them securely and scaling them up to cover the entire screen. Coupled with a mouseover macro, this gave me control over targeting without using a mouse cursor. Here's a video of how it used to work:
https://youtu.be/8APU6SXDNpI
Now in Legion, I changed up my code to cache the unit frames associated with nameplates instead, thinking I could utilize the unit IDs. This works out of combat, but when I'm in combat, the frame handles are no longer accessible. My raid cursor (works the same way, but with raid frames) still works as intended, which probably means it's only related to the name plates. Either that, or I'm missing something vital here.
Tab-targeting seems to be better than ever, but I would ideally like to get this system working again with the new nameplate unit frames, because it gives much better control over tab-targeting when you can actually choose the direction in which it should look for the next target.
Here's the code that no longer works:
Lua Code:
Cursor:SetAttribute("GetPlates", [[
Plates = wipe(Plates)
Visible = 0
for i, frame in pairs(newtable(WorldFrame:GetChildren())) do
local name = frame:GetName()
if name and strmatch(name, "NamePlate") and frame:IsShown() then
local unitFrame = frame:GetChildren() -- returns nil in combat
local unit = unitFrame and unitFrame:GetAttribute("unit")
if unitFrame and unit and PlayerCanAttack(unit) then
Plates[unitFrame] = true
end
Visible = Visible + 1
end
end
]])
Any suggestions on how to solve this, if it's even possible?