6 protected WeaponAttachmentsStorageComponent m_AttachmentStorage;
8 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
10 CharacterControllerComponent charComp = CharacterControllerComponent.Cast(pUserEntity.FindComponent(CharacterControllerComponent));
11 charComp.SetSafety(!IsSafetyOn(),
false);
14 override bool CanBeShownScript(IEntity user)
16 if (!m_WeaponComponent)
18 if (m_AttachmentStorage)
24 IEntity weapon = m_AttachmentStorage.GetParentSlot().GetOwner();
26 m_WeaponComponent = WeaponComponent.Cast(weapon.FindComponent(WeaponComponent));
32 if (m_WeaponComponent.GetCurrentMuzzle().GetMuzzleType() != m_eMuzzleType)
35 CharacterControllerComponent charComp = CharacterControllerComponent.Cast(user.FindComponent(CharacterControllerComponent));
36 return (charComp && charComp.GetInspect());
45 override bool GetActionNameScript(out
string outName)
49 outName = WidgetManager.Translate(
"#AR-Keybind_WeaponSafety (%1)",
"#AR-UserAction_State_On-UC");
53 outName = WidgetManager.Translate(
"#AR-Keybind_WeaponSafety (%1)",
"#AR-UserAction_State_Off-UC");
58 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
62 m_WeaponComponent = WeaponComponent.Cast(pOwnerEntity.FindComponent(WeaponComponent));
67 m_AttachmentStorage = WeaponAttachmentsStorageComponent.Cast(pOwnerEntity.FindComponent(WeaponAttachmentsStorageComponent));