Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WeaponAction.c
Go to the documentation of this file.
5
7{
9 [Attribute( uiwidget: UIWidgets.CheckBox, defvalue: "1", desc: "Should action behave as a toggle")]
10 protected bool m_bIsToggle;
11
13 [Attribute( uiwidget: UIWidgets.CheckBox, defvalue: "1", desc: "Target state of the action, ignored if toggle")]
14 protected bool m_bTargetState;
15
17 [Attribute( uiwidget: UIWidgets.Auto, defvalue: "#AR-UserAction_State_On", desc: "Description of action to toggle on")]
18 protected string m_sActionStateOn;
19
21 [Attribute( uiwidget: UIWidgets.Auto, defvalue: "#AR-UserAction_State_Off", desc: "Description of action to toggle off")]
22 protected string m_sActionStateOff;
23
24 [Attribute("1", UIWidgets.ComboBox, "", "", ParamEnumArray.FromEnum(EWeaponActionType) )]
26
28
29 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
30 {
32 }
33
34 //------------------------------------------------------------------------------------------------
35 override bool CanBeShownScript(IEntity user)
36 {
37 if (!m_Weapon)
38 return false;
39
40 ChimeraCharacter character = ChimeraCharacter.Cast(user);
41 if (!character)
42 return false;
43
44 CharacterControllerComponent controller = character.GetCharacterController();
45 if (!controller)
46 return false;
47
48 if (!controller.GetInspect())
49 return false;
50
52 return m_Weapon && m_Weapon.HasBipod();
53
54 return true;
55 }
56
57 //------------------------------------------------------------------------------------------------
58 override bool CanBePerformedScript(IEntity user)
59 {
60 return m_bIsToggle || (GetState() != m_bTargetState);
61 }
62
63 //------------------------------------------------------------------------------------------------
65 bool GetState()
66 {
67 if (!m_Weapon)
68 return false;
69
71 return m_Weapon.GetBipod();
72
73 return false;
74 }
75
76 //------------------------------------------------------------------------------------------------
78 void SetState(bool enable)
79 {
80 if (!m_Weapon)
81 return;
82
84 m_Weapon.SetBipod(enable);
85 }
86
87 //------------------------------------------------------------------------------------------------
89 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
90 {
91 if (m_bIsToggle)
93 else
95 }
96
97 //------------------------------------------------------------------------------------------------
98 override bool GetActionNameScript(out string outName)
99 {
101 {
102 if (GetState())
103 outName = "#AR-Keybind_BipodRetract";
104 else
105 outName = "#AR-Keybind_Bipod";
106
107 return true;
108 }
109
110 UIInfo uiInfo = GetUIInfo();
111 string prefix;
112 if (uiInfo)
113 prefix = uiInfo.GetName();
114
115 if (!prefix.IsEmpty() && m_bIsToggle)
116 {
117 prefix += " ";
118 if (GetState())
119 outName = prefix + m_sActionStateOff;
120 else
121 outName = prefix + m_sActionStateOn;
122 }
123 else
124 outName = prefix;
125 return true;
126 }
127
128 //------------------------------------------------------------------------------------------------
130 {
131 return true;
132 }
133};
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
EWeaponActionType
@ Bipod
proto external UIInfo GetUIInfo()
Returns the UIInfo set for this user action or null if none.
proto external Managed FindComponent(typename typeName)
bool GetState()
Current state of the feature.
EWeaponActionType m_WeaponActionType
void SetState(bool enable)
Script to change state of the feature.
override bool CanBeShownScript(IEntity user)
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
By default toggle the current state of the interaction.
bool m_bTargetState
Target state of the action, ignored if toggle.
bool m_bIsToggle
Should action behave as a toggle.
string m_sActionStateOn
Description of action to toggle on.
string m_sActionStateOff
Description of action to toggle off.
override bool GetActionNameScript(out string outName)
override bool CanBePerformedScript(IEntity user)
BaseWeaponComponent m_Weapon
override bool HasLocalEffectOnlyScript()
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
UIInfo - allows to define UI elements.
Definition UIInfo.c:14
SCR_FieldOfViewSettings Attribute