Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_VehicleWeaponAmmoCondition.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  //------------------------------------------------------------------------------------------------
17  override bool IsAvailable(SCR_AvailableActionsConditionData data)
18  {
19  if (!data)
20  return false;
21 
22  BaseWeaponComponent weapon = data.GetCurrentVehicleWeapon();
23  if (!weapon)
24  return false;
25 
26  BaseMagazineComponent magazine = weapon.GetCurrentMagazine();
27  if (!magazine)
28  return false;
29 
30  int current = magazine.GetAmmoCount();
31  int max = magazine.GetMaxAmmoCount();
32  bool result = false;
33  if (m_bComparePercentage)
34  {
35  if (max > 0.0)
36  {
37  float perc = (current/(float)max) * 100.0;
38  result = SCR_Comparer<float>.Compare(m_eOperator, perc, m_fValue);
39  return GetReturnResult(result);
40  }
41  return GetReturnResult(false);
42  }
43 
44  result = SCR_Comparer<int>.Compare(m_eOperator, current, (int)m_fValue);
45  return GetReturnResult(result);
46  }
47 };
SCR_AvailableActionsConditionData
Definition: SCR_AvailableActionsConditionData.c:5
SCR_VehicleWeaponAmmoCondition
Returns true if ammo of current vehicle weapon matches the condition.
Definition: SCR_VehicleWeaponAmmoCondition.c:4
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.
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
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