Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDecoCombatMoveControl.c
Go to the documentation of this file.
1 // Script File
2 
3 class SCR_AIDecoCombatMoveControl : DecoratorScripted
4 {
5  static const string PORT_NEXT_COVER = "NextCoverPos";
6  static const string PORT_COMBAT_STANCE = "CombatStance";
7  static const string PORT_ALLOW_STANCE_STAND = "AllowStanceStand";
8 
9  protected SCR_AICombatComponent m_CombatComponent;
10  protected SCR_AIUtilityComponent m_Utility;
11 
12  IEntity m_entity;
13 
14 
15  protected static ref TStringArray s_aVarsOut = {
16  PORT_NEXT_COVER,
17  PORT_COMBAT_STANCE
18  };
19  override TStringArray GetVariablesOut()
20  {
21  return s_aVarsOut;
22  }
23 
24  protected static ref TStringArray s_aVarsIn = {
25  PORT_ALLOW_STANCE_STAND
26  };
27  override TStringArray GetVariablesIn()
28  {
29  return s_aVarsIn;
30  }
31 
32  override void OnInit(AIAgent owner)
33  {
34  m_entity = owner.GetControlledEntity();
35  }
36 
37  protected override bool TestFunction(AIAgent owner)
38  {
39  if (m_entity && !m_CombatComponent)
40  {
41  m_CombatComponent = SCR_AICombatComponent.Cast(m_entity.FindComponent(SCR_AICombatComponent));
42  }
43 
44  if (!m_CombatComponent)
45  return false;
46  else if (!m_Utility)
47  {
48  m_Utility = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
49  }
50 
51  if (!m_CombatComponent.IsActionAllowed(EAICombatActions.MOVEMENT_WHEN_FIRE))
52  return false;
53 
54  vector pos = m_CombatComponent.FindNextCoverPosition();
55  if (pos == vector.Zero)
56  return false;
57 
58  SetVariableOut(PORT_NEXT_COVER, pos);
59 
60  if (m_Utility)
61  {
62  bool allowStand = true;
63  GetVariableIn(PORT_ALLOW_STANCE_STAND, allowStand);
64 
65  ECharacterStance threatStance = GetStanceFromThreat(m_Utility.m_ThreatSystem.GetState());
66  if (threatStance == ECharacterStance.STAND && !allowStand)
67  threatStance = ECharacterStance.CROUCH;
68  SetVariableOut(PORT_COMBAT_STANCE, threatStance);
69  }
70  return true;
71  }
72 
73  protected override bool VisibleInPalette()
74  {
75  return true;
76  }
77 
78  protected override string GetOnHoverDescription()
79  {
80  return "Decorator that controls attack move";
81  }
82 };
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
m_CombatComponent
SCR_AICombatComponent m_CombatComponent
Definition: SCR_AIUtilityComponent.c:12
SCR_AIDecoCombatMoveControl
Definition: SCR_AIDecoCombatMoveControl.c:3