Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIGetMuzzleMagazineWell.c
Go to the documentation of this file.
1 class SCR_AIGetMuzzleMagazineWell: AITaskScripted
2 {
3  protected const static string WEAPON_COMPONENT_PORT = "WeaponComponent";
4  protected const static string MUZZLE_ID_PORT = "MuzzleId";
5 
6  static const string MAGAZINE_WELL_PORT = "MagazineWell";
7  static const string MAGAZINE_WELL_TYPE_PORT = "MagazineWellType";
8 
9  //------------------------------------------------------------------------------------------------
10  override bool VisibleInPalette() {return true;}
11 
12  //------------------------------------------------------------------------------------------------
13  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
14  {
15  BaseWeaponComponent weaponComp;
16  int muzzleId;
17 
18  if (!GetVariableIn(WEAPON_COMPONENT_PORT, weaponComp))
19  return ENodeResult.FAIL;
20  if (!GetVariableIn(MUZZLE_ID_PORT, muzzleId))
21  return ENodeResult.FAIL;
22 
23  if (!weaponComp)
24  return ENodeResult.FAIL;
25 
26  array<BaseMuzzleComponent> muzzles = {};
27  weaponComp.GetMuzzlesList(muzzles);
28 
29  if (muzzleId < 0 || muzzleId >= muzzles.Count())
30  return ENodeResult.FAIL;
31 
32  BaseMuzzleComponent muzzleComp = muzzles[muzzleId];
33 
34  if (!muzzleComp)
35  return ENodeResult.FAIL;
36 
37  BaseMagazineWell magWell = muzzleComp.GetMagazineWell();
38  if (!magWell)
39  return ENodeResult.FAIL;
40 
41  typename magWellType = magWell.Type();
42  SetVariableOut(MAGAZINE_WELL_PORT, magWell);
43  SetVariableOut(MAGAZINE_WELL_TYPE_PORT, magWellType);
44  return ENodeResult.SUCCESS;
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  protected static ref TStringArray s_aVarsOut = { MAGAZINE_WELL_PORT, MAGAZINE_WELL_TYPE_PORT };
49  override TStringArray GetVariablesOut() { return s_aVarsOut; }
50 
51  protected static ref TStringArray s_aVarsIn = { WEAPON_COMPONENT_PORT, MUZZLE_ID_PORT };
52  override TStringArray GetVariablesIn() { return s_aVarsIn; }
53 
54 
55  //------------------------------------------------------------------------------------------------
56  override string GetOnHoverDescription()
57  {
58  return "Returns magazine well and its type of a specific weapon muzzle";
59  };
60 };
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
SCR_AIGetMuzzleMagazineWell
Definition: SCR_AIGetMuzzleMagazineWell.c:1
BaseMagazineWell
Definition: BaseMagazineWell.c:12
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
BaseMuzzleComponent
Definition: BaseMuzzleComponent.c:12