Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AICheckLowAmmo.c
Go to the documentation of this file.
1 class SCR_AICheckLowAmmo : AITaskScripted
2 {
3  protected const static string WEAPON_COMPONENT_PORT = "WeaponComponent";
4  protected const static string MUZZLE_ID_PORT = "MuzzleId";
5  protected const static string LOW_AMMO_PORT = "LowAmmo";
6 
7  protected SCR_AICombatComponent m_CombatComp;
8 
9  protected static ref TStringArray s_aVarsIn = {WEAPON_COMPONENT_PORT, MUZZLE_ID_PORT};
10  override TStringArray GetVariablesIn() { return s_aVarsIn; }
11 
12  protected static ref TStringArray s_aVarsOut = {LOW_AMMO_PORT};
13  override TStringArray GetVariablesOut() { return s_aVarsOut; }
14 
15  //-------------------------------------------------------------------------------
16  override void OnInit(AIAgent owner)
17  {
18  IEntity controlled = owner.GetControlledEntity();
19  if (!controlled)
20  return;
21  m_CombatComp = SCR_AICombatComponent.Cast(controlled.FindComponent(SCR_AICombatComponent));
22  }
23 
24  //-------------------------------------------------------------------------------
25  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
26  {
27  BaseWeaponComponent weaponComp;
28  int muzzleId;
29 
30  // Output
31  bool lowAmmo = false;
32  typename magWellType;
33 
34  GetVariableIn(WEAPON_COMPONENT_PORT, weaponComp);
35  GetVariableIn(MUZZLE_ID_PORT, muzzleId);
36 
37  if (weaponComp && muzzleId != -1)
38  {
39  lowAmmo = m_CombatComp.EvaluateLowAmmo(weaponComp, muzzleId);
40  }
41 
42  SetVariableOut(LOW_AMMO_PORT, lowAmmo);
43  return ENodeResult.SUCCESS;
44  }
45 
46  //-------------------------------------------------------------------------------
47  override bool VisibleInPalette() { return true; }
48 }
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
SCR_AICheckLowAmmo
Definition: SCR_AICheckLowAmmo.c:1
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12