Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIIsFriendlyInAim.c
Go to the documentation of this file.
1 class SCR_AIIsFriendlyInAim : DecoratorScripted
2 {
3  protected PerceptionComponent m_PerceptionComponent;
4  #ifdef WORKBENCH
5  protected ref Shape m_FriendlyAimShape;
6  #endif
7  protected override bool TestFunction(AIAgent owner)
8  {
10  return false;
11 
12  IEntity friendlyEntInAim = m_PerceptionComponent.GetFriendlyInLineOfFire();
13 #ifdef WORKBENCH
14  if (friendlyEntInAim && DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_AI_SHOW_FRIENDLY_IN_AIM))
15  m_FriendlyAimShape = Shape.CreateSphere(COLOR_RED, ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER|ShapeFlags.TRANSP, friendlyEntInAim.GetOrigin() + Vector(0, 2, 0), 0.1);
16  else
17  m_FriendlyAimShape = null;
18 #endif
19 
20  return friendlyEntInAim != null;
21  }
22 
23  override protected void OnInit(AIAgent owner)
24  {
25  IEntity ent = owner.GetControlledEntity();
26 
27  if (!ent)
28  NodeError(this, owner, "SCR_AIIsFriendlyInAim must be used with soldiers");
29 
30  m_PerceptionComponent = PerceptionComponent.Cast(ent.FindComponent(PerceptionComponent));
31 
33  NodeError(this, owner, "Didn't find PerceptionComponent");
34  }
35 
36  protected override string GetOnHoverDescription()
37  {
38  return "SCR_AIIsFriendlyInAim: Returns true when we have a friendly unit in aim. Used for checking against friendly fire.";
39  }
40 };
m_PerceptionComponent
PerceptionComponent m_PerceptionComponent
Definition: SCR_AIUtilityComponent.c:13
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3
SCR_AIIsFriendlyInAim
Definition: SCR_AIIsFriendlyInAim.c:1
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition: DebugMenuID.c:3