How does the component know what is desired rotation?
To get that information it uses interface I_RotatingComponent which has only 1 function GetDesiredRotation.
Both player (BP_CombatCharacter) and AI (BP_BaseAI) classes are implementing this interface.
Let’s take a look at implementation of this function in Base_AI.
Whenever AI has selected target it will return rotation towards that target, otherwise it will return it’s own rotation (nothing will change).