Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AISetCombatMoveState.c
Go to the documentation of this file.
1 class SCR_AISetCombatMoveState : AITaskScripted
2 {
3  // Inputs
4  protected static const string PORT_IN_COVER = "InCover";
5  protected static const string PORT_EXPOSED_IN_COVER = "ExposedInCover";
6  protected static const string PORT_AIM_AT_TARGET = "AimAtTarget";
7 
8  protected SCR_AICombatMoveState m_State;
9 
10  // Return value
11  [Attribute(ENodeResult.SUCCESS.ToString(), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(ENodeResult))]
12  protected ENodeResult m_eReturnValue;
13 
14  // Request state
15  [Attribute()]
16  protected bool m_bSetRequestState;
17  [Attribute("0", UIWidgets.ComboBox, "", enums: ParamEnumArray.FromEnum(SCR_EAICombatMoveRequestState))]
18  protected SCR_EAICombatMoveRequestState m_eRequestStateValue;
19 
20  // Fail reason
21  [Attribute()]
22  protected bool m_bSetRequestFailReason;
23  [Attribute("0", UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(SCR_EAICombatMoveRequestFailReason))]
24  protected SCR_EAICombatMoveRequestFailReason m_eRequestFailReason;
25 
26  // In cover
27  [Attribute()]
28  protected bool m_bSetInCover;
29  [Attribute()]
30  protected bool m_bInCoverValue;
31 
32  // Exposed in cover
33  [Attribute()]
34  protected bool m_bSetExposedInCover;
35  [Attribute()]
36  protected bool m_bExposedInCoverValue;
37 
38  // Fire when moving
39  [Attribute()]
40  protected bool m_bSetAimAtTarget;
41 
42  // Timers
43  [Attribute()]
44  protected bool m_bResetTimer;
45 
46  // Cover lock
47  [Attribute()]
48  protected bool m_bReleaseCoverLock;
49 
50  //--------------------------------------------------------------------------------------------
51  override void OnInit(AIAgent owner)
52  {
53  SCR_AIUtilityComponent utilityComp = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
54  if (utilityComp)
55  m_State = utilityComp.m_CombatMoveState;
56  }
57 
58  //--------------------------------------------------------------------------------------------
59  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
60  {
61  if (!m_State)
62  return ENodeResult.FAIL;
63 
64  if (m_bSetInCover)
65  {
66  if (!GetVariableIn(PORT_IN_COVER, m_State.m_bInCover))
67  m_State.m_bInCover = m_bInCoverValue;
68  }
69 
70  if (m_bSetExposedInCover)
71  {
72  if (!GetVariableIn(PORT_EXPOSED_IN_COVER, m_State.m_bExposedInCover))
73  m_State.m_bExposedInCover = m_bExposedInCoverValue;
74  }
75 
76  if (m_bSetAimAtTarget)
77  {
78  GetVariableIn(PORT_AIM_AT_TARGET, m_State.m_bAimAtTarget);
79  }
80 
81  if (m_bReleaseCoverLock)
82  {
83  m_State.ReleaseCover();
84  }
85 
86  return m_eReturnValue;
87  }
88 
89 
90 
91  //--------------------------------------------------------------------------------------------
92  override bool VisibleInPalette() { return true; }
93 
94  override string GetNodeMiddleText()
95  {
96  array<string> strings = {
97  "m_bSetRequestState",
98  "m_bSetRequestFailReason",
99  "m_bSetInCover",
100  "m_bSetExposedInCover",
101  "m_bResetTimer",
102  "m_bReleaseCoverLock"
103  };
104  array<bool> values = {
105  m_bSetRequestState,
106  m_bSetRequestFailReason,
107  m_bSetInCover,
108  m_bSetExposedInCover,
109  m_bResetTimer,
110  m_bReleaseCoverLock
111  };
112 
113  string str;
114  int nLinesAdded = 1;
115  str = str + string.Format("Node Result: %1", typename.EnumToString(ENodeResult, m_eReturnValue));
116  for (int i = 0; i < strings.Count(); i++)
117  {
118  if (values[i])
119  {
120  if (nLinesAdded > 0)
121  str = str + "\n";
122  str = str + string.Format("%1: %2", strings[i], values[i]);
123 
124  string varName, varValue;
125  if (i == 0) // m_bSetRequestState
126  {
127  varName = "m_eRequestStateValue";
128  varValue = typename.EnumToString(SCR_EAICombatMoveRequestState, m_eRequestStateValue);
129  }
130  else if (i == 1) // m_bSetRequestFailReason
131  {
132  varName = "m_eRequestFailReason";
133  varValue = typename.EnumToString(SCR_EAICombatMoveRequestFailReason, m_eRequestFailReason);
134  }
135  else if (i == 2) // m_bSetInCover
136  {
137  varName = "m_bInCoverValue";
138  varValue = m_bInCoverValue.ToString();
139  }
140  else if (i == 3) // m_bSetExposedInCover
141  {
142  varName = "m_bExposedInCoverValue";
143  varValue = m_bExposedInCoverValue.ToString();
144  }
145 
146  if (!varName.IsEmpty() && !varValue.IsEmpty())
147  str = str + string.Format("\n%1: %2", varName, varValue);
148 
149  nLinesAdded++;
150  }
151  }
152  return str;
153  }
154 
155  protected static ref TStringArray s_aVarsIn = {
156  PORT_IN_COVER,
157  PORT_EXPOSED_IN_COVER,
158  PORT_AIM_AT_TARGET
159  };
160  override TStringArray GetVariablesIn() { return s_aVarsIn; }
161 }
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_AISetCombatMoveState
Definition: SCR_AISetCombatMoveState.c:1
m_State
private EEditableEntityState m_State
Definition: SCR_BaseEntitiesEditorUIEffect.c:3
SCR_EAICombatMoveRequestState
SCR_EAICombatMoveRequestState
Definition: SCR_AICombatMoveState.c:1