Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIIsTargetVisible.c
Go to the documentation of this file.
1 // Script File//------------------------------------------------------------------------------------------------
2 class SCR_AIIsTargetVisible : DecoratorScripted
3 {
4  static const string BASE_TARGET_PORT = "BaseTargetIn";
5 
6  SCR_AICombatComponent m_CombatComp;
7 
8  //-----------------------------------------------------------------------------------------------------
9  protected override bool TestFunction(AIAgent owner)
10  {
11  if (!m_CombatComp)
12  {
13  IEntity controlledEntity = owner.GetControlledEntity();
14  if (controlledEntity)
15  m_CombatComp = SCR_AICombatComponent.Cast(owner.FindComponent(SCR_AICombatComponent));
16 
17  if (!m_CombatComp)
18  return false;
19  }
20 
21  BaseTarget target;
22  GetVariableIn(BASE_TARGET_PORT,target);
23 
24  if (!target)
25  return false;
26 
27  bool visible = m_CombatComp.IsTargetVisible(target);
28 
29  return visible;
30  }
31 
32  //-----------------------------------------------------------------------------------------------------
33  protected override bool VisibleInPalette()
34  {
35  return true;
36  }
37 
38  //-----------------------------------------------------------------------------------------------------
39  protected override string GetOnHoverDescription()
40  {
41  return "IsTargetVisible: Checks if target is visible. The check is performed through Combat Component.";
42  }
43 
44  //-----------------------------------------------------------------------------------------------------
45  protected static ref TStringArray s_aVarsIn = {
46  BASE_TARGET_PORT
47  };
48  protected override TStringArray GetVariablesIn()
49  {
50  return s_aVarsIn;
51  }
52 };
BaseTarget
Definition: BaseTarget.c:12
SCR_AIIsTargetVisible
Definition: SCR_AIIsTargetVisible.c:2