Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_LookAtGroupCommand.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
4{
5 //------------------------------------------------------------------------------------------------
6 override bool Execute(IEntity cursorTarget, IEntity target, vector targetPosition, int playerID, bool isClient)
7 {
8 if (isClient && playerID == SCR_PlayerController.GetLocalPlayerId())
9 return true;
10
11 if (!target || !targetPosition)
12 return false;
13
14 return LookAtPosition(target, targetPosition, playerID);
15 }
16
17 //------------------------------------------------------------------------------------------------
18 bool LookAtPosition(IEntity target, vector targetPosition, int playerID)
19 {
20 SCR_AIGroup group = SCR_AIGroup.Cast(target);
21 if (!target)
22 return false;
23
24 array<AIAgent> agents = {};
25 group.GetAgents(agents);
26
27 SCR_AIUtilityComponent utilityComponent;
28 foreach (AIAgent agent : agents)
29 {
30 if (!agent)
31 continue;
32
33 utilityComponent = SCR_AIUtilityComponent.Cast(agent.FindComponent(SCR_AIUtilityComponent));
34 if (!utilityComponent)
35 continue;
36
37 utilityComponent.LookAt(targetPosition);
38 }
39
40 return true;
41 }
42
43 //------------------------------------------------------------------------------------------------
44 override bool CanBeShown()
45 {
47 return false;
48
49 SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.GetLocalPlayerControllerGroupComponent();
50 return groupController && CanRoleShow();
51 }
52}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override bool CanBeShownInCurrentLifeState()
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.