9 [
Attribute( uiwidget: UIWidgets.CheckBox, defvalue:
"1",
desc:
"Should action behave as a toggle")]
10 protected bool m_bIsToggle;
13 [
Attribute( uiwidget: UIWidgets.CheckBox, defvalue:
"1",
desc:
"Target state of the action, ignored if toggle")]
14 protected bool m_bTargetState;
17 [
Attribute( uiwidget: UIWidgets.Auto, defvalue:
"#AR-UserAction_State_On",
desc:
"Description of action to toggle on")]
18 protected string m_sActionStateOn;
21 [
Attribute( uiwidget: UIWidgets.Auto, defvalue:
"#AR-UserAction_State_Off",
desc:
"Description of action to toggle off")]
22 protected string m_sActionStateOff;
29 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
31 m_Weapon = WeaponComponent.Cast(pOwnerEntity.FindComponent(WeaponComponent));
35 override bool CanBeShownScript(IEntity user)
40 ChimeraCharacter character = ChimeraCharacter.Cast(user);
44 CharacterControllerComponent controller = character.GetCharacterController();
48 if (!controller.GetInspect())
58 override bool CanBePerformedScript(IEntity user)
60 return m_bIsToggle || (GetState() != m_bTargetState);
78 void SetState(
bool enable)
89 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
92 SetState(!GetState());
94 SetState(m_bTargetState);
98 override bool GetActionNameScript(out
string outName)
103 outName =
"#AR-Keybind_BipodRetract";
105 outName =
"#AR-Keybind_Bipod";
113 prefix = uiInfo.GetName();
115 if (!prefix.IsEmpty() && m_bIsToggle)
119 outName = prefix + m_sActionStateOff;
121 outName = prefix + m_sActionStateOn;
129 override bool HasLocalEffectOnlyScript()