Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VehicleWeaponAmmoCondition.c
Go to the documentation of this file.
1
4{
5 [Attribute(defvalue: SCR_ComparerOperator.GREATER_THAN.ToString(), desc: "Condition operator", uiwidget: UIWidgets.ComboBox, enumType: 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 //------------------------------------------------------------------------------------------------
16 override bool IsAvailable(notnull SCR_AvailableActionsConditionData data)
17 {
18 BaseWeaponComponent weapon = data.GetCurrentVehicleWeapon();
19 if (!weapon)
20 return false;
21
22 BaseMagazineComponent magazine = weapon.GetCurrentMagazine();
23 if (!magazine)
24 return false;
25
26 int current = magazine.GetAmmoCount();
27 int max = magazine.GetMaxAmmoCount();
28 bool result = false;
29 if (m_bComparePercentage)
30 {
31 if (max > 0.0)
32 {
33 float perc = (current/(float)max) * 100.0;
34 result = SCR_Comparer<float>.Compare(m_eOperator, perc, m_fValue);
35 return GetReturnResult(result);
36 }
37 return GetReturnResult(false);
38 }
39
40 result = SCR_Comparer<int>.Compare(m_eOperator, current, (int)m_fValue);
41 return GetReturnResult(result);
42 }
43}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_ComparerOperator
Definition SCR_Comparer.c:3
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
A single available action condition representation.
Returns true if ammo of current vehicle weapon matches the condition.
Definition float.c:13
SCR_FieldOfViewSettings Attribute