Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CharacterHasGadgetCondition.c
Go to the documentation of this file.
1
5{
6 [Attribute("1", UIWidgets.CheckBox, "Only if gadget is in hands", "")]
7 protected bool m_bEquipped;
8
9 [Attribute("0", UIWidgets.CheckBox, "Only if gadget is not in hands and in ", "")]
10 protected bool m_bNotEquipped;
11
12 [Attribute("1", UIWidgets.CheckBox, "Specified gadget type", "")]
13 protected bool m_bCheckSpecificGadget;
14
15 [Attribute(defvalue: SCR_Enum.GetDefault(EGadgetType.MAP), UIWidgets.ComboBox, "Gadget type", "", ParamEnumArray.FromEnum(EGadgetType))]
16 protected EGadgetType m_eGadget;
17
18 [Attribute("0", UIWidgets.CheckBox, "Pass if the gadget is turned on", "")]
19 protected bool m_bIsToggledOn;
20
21 [Attribute("0", UIWidgets.CheckBox, "Pass if the gadget is turned off", "")]
22 protected bool m_bIsToggledOff;
23
24 //------------------------------------------------------------------------------------------------
28 {
29 bool equipped;
30 SCR_GadgetComponent gadgetComponent = data.GetHeldGadgetComponent();
31 if (gadgetComponent)
32 {
34 equipped = gadgetComponent.GetType() == m_eGadget;
35 else
36 equipped = true;
37 }
38
39 // Force failure if expected as unequipped while gadget is equipped
40 if (equipped && m_bNotEquipped)
41 return false;
42
43 bool result;
44 if (m_bEquipped)
45 {
46 result = equipped;
47 }
48 else
49 {
50 // Check gadgets that are not in hands
51 gadgetComponent = null;
52
53 // Force failure if there is no gadget at that point
54 IEntity gadget = data.GetGadget(m_eGadget);
55 if (!gadget)
56 return false;
57
58 // Get new gadget component or clear
60 gadgetComponent = SCR_GadgetComponent.Cast(gadget.FindComponent(SCR_GadgetComponent));
61
62 result = true;
63 }
64
65 // Allow only toggled on or off
66 if (result && (m_bIsToggledOn || m_bIsToggledOff))
67 {
68 // Pass if either requirement is met
69 bool isToggledOn = gadgetComponent && gadgetComponent.IsToggledOn();
70 if (isToggledOn && m_bIsToggledOn)
71 result = true;
72 else if (!isToggledOn && m_bIsToggledOff)
73 result = true;
74 else
75 result = false;
76 }
77
78 return GetReturnResult(result);
79 }
80}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Get all prefabs that have the spawner data
proto external Managed FindComponent(typename typeName)
A single available action condition representation.
override bool IsAvailable(notnull SCR_AvailableActionsConditionData data)
SCR_FieldOfViewSettings Attribute