Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WeaponFireModeCondition.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  [Attribute("0", uiwidget: UIWidgets.ComboBox, "Fire mode to check", "", ParamEnumArray.FromEnum(EWeaponFiremodeType))]
6  protected EWeaponFiremodeType m_iValue;
7 
8  [Attribute("true", uiwidget: UIWidgets.CheckBox, "True = currently active, False = contains")]
9  protected bool m_bIsCurrent;
10 
11  //------------------------------------------------------------------------------------------------
12  override bool IsAvailable(SCR_AvailableActionsConditionData data)
13  {
14  // Check muzzle
15  BaseMuzzleComponent muzzle = data.GetCurrentMuzzle();
16  if (!muzzle)
17  return false;
18 
19  // Get result
20  bool result = false;
21 
22  if (m_bIsCurrent)
23  {
24  BaseFireMode mode = muzzle.GetCurrentFireMode();
25  if (mode)
26  result = (mode.GetFiremodeType() == m_iValue);
27  }
28  else
29  result = ContainsMode(muzzle, m_iValue);
30 
31  return GetReturnResult(result);
32  }
33 
34  //------------------------------------------------------------------------------------------------
35  protected bool ContainsMode(BaseMuzzleComponent muzzle, EWeaponFiremodeType modeType)
36  {
37  // Get fire modes list
38  array<BaseFireMode> fireModes = {};
39  muzzle.GetFireModesList(fireModes);
40 
41  // Go throught fire modes
42  int count = fireModes.Count();
43  for (int i = 0; i < count; i++)
44  {
45  // Contains mode
46  if (fireModes[i].GetFiremodeType() == modeType)
47  return true;
48  }
49 
50  // Not found
51  return false;
52  }
53 };
SCR_AvailableActionsConditionData
Definition: SCR_AvailableActionsConditionData.c:5
EWeaponFiremodeType
EWeaponFiremodeType
Definition: EWeaponFiremodeType.c:12
m_iValue
protected int m_iValue
Definition: SCR_VotingBase.c:3
SCR_AvailableActionCondition
A single available action condition representation.
Definition: SCR_AvailableActionsCondition.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
BaseFireMode
Definition: BaseFireMode.c:12
SCR_WeaponFiremodeCondition
Definition: SCR_WeaponFireModeCondition.c:3
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
BaseMuzzleComponent
Definition: BaseMuzzleComponent.c:12
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468