Files
AetherBags/KamiToolKit/Extensions/AtkStageExtensions.cs
T
KnackAtNite 8db4ce6094
Debug Build and Test / Build against Latest Dalamud (push) Has been cancelled
Debug Build and Test / Build against Staging Dalamud (push) Has been cancelled
Initial commit: AetherBags + KamiToolKit for FC Gitea
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 14:46:31 -05:00

40 lines
1.5 KiB
C#

using FFXIVClientStructs.FFXIV.Component.GUI;
namespace KamiToolKit.Extensions;
public static unsafe class AtkStageExtensions {
extension(ref AtkStage atkStage) {
public void ClearNodeFocus(AtkResNode* targetNode) {
if (targetNode is null) return;
foreach (ref var focusEntry in atkStage.AtkInputManager->FocusList) {
// If this entry has no listener/addon, skip it
if (focusEntry.AtkEventListener is null) continue;
// If this entry has our target node
if (focusEntry.AtkEventTarget == targetNode) {
// Clear the entry
focusEntry.AtkEventTarget = null;
focusEntry.FocusParam = 0;
// Clear the input managers focused node
atkStage.AtkInputManager->FocusedNode = null;
// Clear collision managers collision node
atkStage.AtkCollisionManager->IntersectingCollisionNode = null;
// Also remove this node from any additional focus nodes the addon might reference
var addon = (AtkUnitBase*) focusEntry.AtkEventListener;
foreach (ref var node in addon->AdditionalFocusableNodes) {
if (node.Value == targetNode) {
node = null;
}
}
}
}
}
}
}