6 override bool Execute(
IEntity cursorTarget,
IEntity target,
vector targetPosition,
int playerID,
bool isClient)
15 if (!playerController)
18 SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.Cast(playerController.FindComponent(SCR_PlayerControllerGroupComponent));
22 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(cursorTarget);
26 if (
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(character) == 0)
27 groupController.RequestAddAIAgent(character, playerID);
33 override bool CanBeExecuted(
IEntity target)
35 if (!target || !super.CanBeExecuted(target))
38 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(target);
42 if (!character.IsRecruitable())
48 SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
52 SCR_AIGroup group = groupController.GetPlayersGroup();
58 Faction targetFaction = character.GetFaction();
60 if (targetFaction && controllerFaction && (targetFaction.GetFactionKey() != controllerFaction.GetFactionKey()))
68 if (!commandingManager)
71 int maxAI = commandingManager.GetMaxAIPerGroup();
73 if (maxAI != -1 && slaveGroup.GetServerAgentsCount() >= maxAI)
88 PlayerCamera camera =
GetGame().GetPlayerController().GetPlayerCamera();
92 IEntity cursorTarget = camera.GetCursorTarget();
93 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(cursorTarget);
97 if (character.IsRecruited())
101 if (!playerController)
104 SCR_RespawnSystemComponent respawnComponent = SCR_RespawnSystemComponent.GetInstance();
105 if (!respawnComponent)
108 SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
109 if (!groupController)
112 SCR_AIGroup group = groupController.GetPlayersGroup();
122 int playerID =
GetGame().GetPlayerController().GetPlayerId();
128 playerFaction =
SCR_Faction.Cast(factionManager.GetPlayerFaction(playerID));
131 return !groupController.IsAICharacterInAnyGroup(character, playerFaction);