Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDecoIsAboveThreatLevel.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
2 class SCR_AIDecoIsAboveThreatLevel : DecoratorScripted
3 {
4  static private string THRESHOLD_PORT = "ThresholdIn";
5 
6  SCR_AIInfoComponent m_InfoComponent;
7 
8  [Attribute("1", UIWidgets.ComboBox, "Threat threshold", "", ParamEnumArray.FromEnum(EAIThreatState) )]
9  private EAIThreatState m_threatThreshold;
10 
11  //------------------------------------------------------------------------------------------------
12  protected override void OnInit(AIAgent owner)
13  {
14  SCR_ChimeraAIAgent chimeraAgent = SCR_ChimeraAIAgent.Cast(owner);
15  if (!chimeraAgent)
16  SCR_AgentMustChimera(this, owner);
17  m_InfoComponent = chimeraAgent.m_InfoComponent;
18  }
19 
20  //------------------------------------------------------------------------------------------------
21  protected override bool TestFunction(AIAgent owner)
22  {
23  if (!m_InfoComponent)
24  {
25  return false;
26  };
27 
28  EAIThreatState threshold;
29  if (!GetVariableIn(THRESHOLD_PORT,threshold))
30  threshold = m_threatThreshold;
31 
32  return threshold < m_InfoComponent.GetThreatState();
33  }
34 
35  //------------------------------------------------------------------------------------------------
36  protected override string GetOnHoverDescription()
37  {
38  return "Returns true if current threat state is higher than given threshold.";
39  }
40 
41  //------------------------------------------------------------------------------------------------
42  override protected string GetNodeMiddleText()
43  {
44  return "Threshold: " + typename.EnumToString(EAIThreatState,m_threatThreshold);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  protected static ref TStringArray s_aVarsIn = {
49  THRESHOLD_PORT
50  };
51  protected override TStringArray GetVariablesIn()
52  {
53  return s_aVarsIn;
54  }
55 };
SCR_AgentMustChimera
ENodeResult SCR_AgentMustChimera(Node node, AIAgent owner)
Definition: NodeError.c:21
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ChimeraAIAgent
Definition: SCR_ChimeraAIAgent.c:5
SCR_AIDecoIsAboveThreatLevel
Definition: SCR_AIDecoIsAboveThreatLevel.c:2