Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDecoIsAboveThreatLevel.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
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 static 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};
ENodeResult SCR_AgentMustChimera(Node node, AIAgent owner)
Definition NodeError.c:21
proto bool GetVariableIn(string name, out void val)
override void OnInit(AIAgent owner)
override bool TestFunction(AIAgent owner)
static override string GetOnHoverDescription()
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
Definition Types.c:385