Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AICombatMoveUtils.c
Go to the documentation of this file.
1 /*
2 Class with misc functions for combat movement
3 */
4 
6 {
7  // Threshold distance beyond which it is considered we are in long range fight
8  static const float CLOSE_RANGE_COMBAT_DIST = 40.0;
9 
11  static vector CalculateMoveDirection(SCR_EAICombatMoveDirection eDirection, vector myPos, vector movePos)
12  {
13  // Special cases
14  if (eDirection == SCR_EAICombatMoveDirection.ANYWHERE)
15  {
16  // Random direction
17  float bearing = Math.RandomFloat(0, Math.PI2);
18  vector dirOut = Vector(Math.Cos(bearing), 0, Math.Sin(bearing));
19  return dirOut;
20  }
21  else if (eDirection == SCR_EAICombatMoveDirection.CUSTOM_POS)
22  {
23  vector dirToTarget = vector.Direction(myPos, movePos);
24  dirToTarget.Normalize();
25  return dirToTarget;
26  }
27 
28  // Generic directions
29 
30  vector dirToTarget = vector.Direction(myPos, movePos);
31  dirToTarget.Normalize();
32  vector dirSideways = (dirToTarget * Vector(0, 1, 0));
33 
34  switch (eDirection)
35  {
36  case SCR_EAICombatMoveDirection.FORWARD: return dirToTarget;
37  case SCR_EAICombatMoveDirection.BACKWARD: return -dirToTarget;
38  case SCR_EAICombatMoveDirection.RIGHT: return -dirSideways;
39  case SCR_EAICombatMoveDirection.LEFT: return dirSideways;
40  }
41  return vector.Zero;
42  }
43 
46  static bool IsAimingAndMovementPossible(ECharacterStance stance, EMovementType moveType)
47  {
48  if (stance == ECharacterStance.PRONE)
49  return false;
50 
51  if (moveType == EMovementType.SPRINT)
52  return false;
53 
54  return true;
55  }
56 }
SCR_AICombatMoveUtils
Definition: SCR_AICombatMoveUtils.c:5
EMovementType
EMovementType
Definition: EMovementType.c:12
ECharacterStance
ECharacterStance
Definition: ECharacterStance.c:12