Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WeaponAmmoCountCondition.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
5 {
6  [Attribute("3", UIWidgets.ComboBox, "Cond operator", "", ParamEnumArray.FromEnum(SCR_ComparerOperator) )]
7  private SCR_ComparerOperator m_eOperator;
8 
9  [Attribute("1", UIWidgets.ComboBox, "Should comparison be done using percentage of ammo?", "" )]
10  private bool m_bComparePercentage;
11 
12  [Attribute("2", UIWidgets.EditBox, "Percentages are 0-100, non-percentage values are rounded to integers", "")]
13  private float m_fValue;
14 
15  //------------------------------------------------------------------------------------------------
18  override bool IsAvailable(SCR_AvailableActionsConditionData data)
19  {
20  if (!data)
21  return false;
22 
23  BaseMagazineComponent magazine = data.GetCurrentMagazine();
24  if (!magazine)
25  return false;
26 
27  int current = magazine.GetAmmoCount();
28  int max = magazine.GetMaxAmmoCount();
29  bool result = false;
30  if (m_bComparePercentage)
31  {
32  if (max > 0.0)
33  {
34  float perc = (current/(float)max) * 100.0;
35  result = SCR_Comparer<float>.Compare(m_eOperator, perc, m_fValue);
36  return GetReturnResult(result);
37  }
38  return GetReturnResult(false);
39  }
40 
41  result = SCR_Comparer<int>.Compare(m_eOperator, current, (int)m_fValue);
42  return GetReturnResult(result);
43  }
44 };
SCR_WeaponAmmoCountCondition
Returns true if ammo of current weapon matches the condition.
Definition: SCR_WeaponAmmoCountCondition.c:4
SCR_AvailableActionsConditionData
Definition: SCR_AvailableActionsConditionData.c:5
SCR_AvailableActionCondition
A single available action condition representation.
Definition: SCR_AvailableActionsCondition.c:3
SCR_ComparerOperator
SCR_ComparerOperator
Definition: SCR_Comparer.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
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