Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIGetCoverParameters.c
Go to the documentation of this file.
1 class SCR_AIGetCoverParameters : AITaskScripted
2 {
3  // Inputs
4  protected static const string PORT_COVER_LOCK = "CoverLock";
5 
6  // Outputs
7  protected static const string PORT_POS = "Pos";
8  protected static const string PORT_STANCE = "Stance";
9  protected static const string PORT_STANCE_HIDE = "StanceHide";
10 
11  //------------------------------------------------------------------------------------------------
12  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
13  {
14  SCR_AICoverLock coverLock;
15  GetVariableIn(PORT_COVER_LOCK, coverLock);
16  if (!coverLock || !coverLock.IsValid())
17  return ENodeResult.FAIL;
18 
19  float coverHeight = coverLock.m_vCoverTallestPos[1] - coverLock.m_vCoverPos[1];
20  ECharacterStance stance, stanceHide;
21 
22  CalculateCoverStance(coverHeight, stance, stanceHide);
23 
24  SetVariableOut(PORT_POS, coverLock.m_vCoverPos);
25  SetVariableOut(PORT_STANCE, stance);
26  SetVariableOut(PORT_STANCE_HIDE, stanceHide);
27 
28  return ENodeResult.SUCCESS;
29  }
30 
31  //------------------------------------------------------------------------------------------------
32  void CalculateCoverStance(float height, out ECharacterStance outStance, out ECharacterStance outStanceHide)
33  {
34  if (height > 0.85)
35  {
36  outStance = ECharacterStance.STAND;
37  outStanceHide = ECharacterStance.CROUCH;
38  }
39  else
40  {
41  outStance = ECharacterStance.CROUCH;
42  outStanceHide = ECharacterStance.PRONE;
43  }
44  }
45 
46  //------------------------------------------------------------------------------------------------
47  protected static ref TStringArray s_aVarsOut = {
48  PORT_POS,
50  PORT_STANCE_HIDE
51  };
52  override TStringArray GetVariablesOut() { return s_aVarsOut; }
53 
54  protected static ref TStringArray s_aVarsIn = {
55  PORT_COVER_LOCK
56  };
57  override TStringArray GetVariablesIn() { return s_aVarsIn; }
58 
59  override bool VisibleInPalette() { return true; }
60 }
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
SCR_AICoverLock
Definition: SCR_AICoverLock.c:19
PORT_STANCE
SCR_AIGetCombatMoveRequestParameters_ChangeStanceInCover PORT_STANCE
SCR_AIGetCoverParameters
Definition: SCR_AIGetCoverParameters.c:1