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