Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIEvaluateExpectedWeapon.c
Go to the documentation of this file.
1 
4 class SCR_AIEvaluateExpectedWeapon : AITaskScripted
5 {
6  // Output ports
7  protected static const string PORT_WEAPON_COMPONENT = "WeaponComponent";
8  protected static const string PORT_MAGAZINE_COMPONENT = "MagazineComponent";
9  protected static const string PORT_MUZZLE_ID = "MuzzleId";
10 
11  protected SCR_AICombatComponent m_CombatComponent;
12 
13  protected BaseWeaponComponent m_WeaponComp;
14  protected int m_MuzzleId;
15  protected BaseMagazineComponent m_MagazineComp;
16 
17  //--------------------------------------------------------------------------------------------
18  override void OnInit(AIAgent owner)
19  {
20  IEntity controlledEnt = owner.GetControlledEntity();
21  m_CombatComponent = SCR_AICombatComponent.Cast(controlledEnt.FindComponent(SCR_AICombatComponent));
22 
23  if (!m_CombatComponent)
24  {
25  NodeError(this, owner, "SCR_AIEvaluateExpectedWeapon didn't find necessary components!");
26  }
27  }
28 
29  //--------------------------------------------------------------------------------------------
30  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
31  {
32  if (!m_CombatComponent)
33  return ENodeResult.FAIL;
34 
35  BaseWeaponComponent weaponComp;
36  BaseMagazineComponent magazineComp;
37  int muzzleId;
38 
39  m_CombatComponent.EvaluateExpectedWeapon(weaponComp, muzzleId, magazineComp);
40 
41  if (!weaponComp)
42  return ENodeResult.FAIL;
43 
44  SetVariableOut(PORT_WEAPON_COMPONENT, weaponComp);
45  SetVariableOut(PORT_MAGAZINE_COMPONENT, magazineComp);
46  SetVariableOut(PORT_MUZZLE_ID, muzzleId);
47 
48  return ENodeResult.SUCCESS;
49  }
50 
51  //--------------------------------------------------------------------------------------------
52  override bool VisibleInPalette() { return true; }
53 
54  protected static ref TStringArray s_aVarsOut = {
55  PORT_WEAPON_COMPONENT,
56  PORT_MUZZLE_ID,
57  PORT_MAGAZINE_COMPONENT
58  };
59  override TStringArray GetVariablesOut() { return s_aVarsOut; }
60 }
SCR_AIEvaluateExpectedWeapon
Definition: SCR_AIEvaluateExpectedWeapon.c:4
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
m_CombatComponent
SCR_AICombatComponent m_CombatComponent
Definition: SCR_AIUtilityComponent.c:12