Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIUpdateCombatMoveStateTimers.c
Go to the documentation of this file.
1 class SCR_AIUpdateCombatMoveStateTimers : AITaskScripted
2 {
3  protected static const string PORT_RESET = "Reset";
4 
5  protected SCR_AICombatMoveState m_State;
6 
7  //--------------------------------------------------------------------------------------------
8  override void OnInit(AIAgent owner)
9  {
10  SCR_AIUtilityComponent utilityComp = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
11  if (utilityComp)
12  m_State = utilityComp.m_CombatMoveState;
13  }
14 
15  //--------------------------------------------------------------------------------------------
16  override void OnAbort(AIAgent owner, Node nodeCausingAbort)
17  {
18  if (m_State)
19  m_State.m_fTimerRequest_s = 0;
20  }
21 
22  //--------------------------------------------------------------------------------------------
23  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
24  {
25  if (!m_State)
26  return ENodeResult.FAIL;
27 
28  int reset;
29  GetVariableIn(PORT_RESET, reset);
30 
31  if (reset)
32  m_State.m_fTimerRequest_s = 0;
33  else
34  m_State.m_fTimerRequest_s += dt;
35 
36  if (m_State.m_bInCover)
37  m_State.m_fTimerInCover_s += dt;
38  else
39  m_State.m_fTimerInCover_s = 0;
40 
41  if (m_State.IsMoving())
42  m_State.m_fTimerStopped_s = 0;
43  else
44  m_State.m_fTimerStopped_s += dt;
45 
46 
47  return ENodeResult.SUCCESS;
48  }
49 
50  //--------------------------------------------------------------------------------------------
51  override bool VisibleInPalette() { return true; }
52 
53  protected ref TStringArray s_aVarsIn = { PORT_RESET };
54  override TStringArray GetVariablesIn()
55  {
56  return s_aVarsIn;
57  }
58 }
SCR_AIUpdateCombatMoveStateTimers
Definition: SCR_AIUpdateCombatMoveStateTimers.c:1
m_State
private EEditableEntityState m_State
Definition: SCR_BaseEntitiesEditorUIEffect.c:3