Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIGetSuppressionPosition.c
Go to the documentation of this file.
1 class SCR_AIGetSuppressionPosition: AITaskScripted
2 {
3  static const string PORT_DURATION = "DurationIn";
4  static const string PORT_SHOOT_START = "ShootStartIn";
5  static const string PORT_SHOOT_END = "ShootEndIn";
6  static const string PORT_AIM_POSITION = "AimPositionOut";
7  static const string PORT_AIM_TIME = "AimTimeOut";
8  static const string PORT_RESET_TIME = "ResetTime";
9  static const string PORT_RESET_TIME_OUT = "ResetTimeOut";
10 
11  [Attribute("50", UIWidgets.EditBox, desc: "Number of LERP steps" )]
12  private int m_fSteps;
13 
14  private float m_fIterativeStep,m_fCurrentTime,m_fDuration;
15 
16  private vector m_vStart,m_vEnd,m_vDirection;
17 
18  protected static ref TStringArray s_aVarsIn = {
19  PORT_DURATION,
20  PORT_SHOOT_START,
21  PORT_SHOOT_END,
22  PORT_RESET_TIME
23  };
24  override array<string> GetVariablesIn()
25  {
26  return s_aVarsIn;
27  }
28 
29  protected static ref TStringArray s_aVarsOut = {
30  PORT_AIM_POSITION,
31  PORT_AIM_TIME,
32  PORT_RESET_TIME_OUT
33  };
34  override array<string> GetVariablesOut()
35  {
36  return s_aVarsOut;
37  }
38 
39  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
40  {
41  bool reset;
42  GetVariableIn(PORT_DURATION, m_fDuration);
43  GetVariableIn(PORT_RESET_TIME, reset);
44  if (reset)
45  {
46  m_fCurrentTime = 0;
47  SetVariableOut(PORT_RESET_TIME_OUT, false);
48  };
49 
50  if (m_fDuration < 1e-10)
51  return ENodeResult.FAIL;
52  m_fIterativeStep = 1 / m_fSteps;
53 
54  if (!GetVariableIn(PORT_SHOOT_START,m_vStart) || !GetVariableIn(PORT_SHOOT_END,m_vEnd))
55  return ENodeResult.FAIL;
56 
57  SetVariableOut(PORT_AIM_TIME,m_fDuration/m_fSteps);
58  m_vDirection = (m_vEnd - m_vStart);
59 
60  m_vDirection *= Math.Clamp(m_fCurrentTime,0,1);
61 
62  //PrintFormat("Covering current time step: %1", m_fCurrentTime);
63  SetVariableOut(PORT_AIM_POSITION,m_vStart + m_vDirection);
64  m_fCurrentTime += m_fIterativeStep;
65 
66  return ENodeResult.SUCCESS;
67  }
68 
69  protected override string GetOnHoverDescription()
70  {
71  return "Calculate position to shoot at during suppressive fire";
72  }
73 
74  override bool VisibleInPalette()
75  {
76  return true;
77  }
78 };
79 
m_fDuration
float m_fDuration
Definition: SendGoalMessage.c:437
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_AIGetSuppressionPosition
Definition: SCR_AIGetSuppressionPosition.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.