5 #ifndef DISABLE_INVENTORY
6 SCR_InventoryStorageManagerComponent m_InventoryManager;
11 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
21 override protected void PerformActionInternal(SCR_InventoryStorageManagerComponent manager, IEntity pOwnerEntity, IEntity pUserEntity)
23 WeaponAttachmentsStorageComponent storage = WeaponAttachmentsStorageComponent.Cast(m_WeaponComponent.GetOwner().FindComponent(WeaponAttachmentsStorageComponent));
26 BaseMagazineComponent magazine = BaseMagazineComponent.Cast(pOwnerEntity.FindComponent(BaseMagazineComponent));
27 CharacterControllerComponent ctrl = CharacterControllerComponent.Cast(pUserEntity.FindComponent(CharacterControllerComponent));
30 bool bEmpty = storage.Get(0) ==
null;
31 ctrl.ReloadWeaponWith(pOwnerEntity, !bEmpty);
35 manager.TrySwapItemStorages(pOwnerEntity, storage.Get(0));
37 manager.PlayItemSound(pOwnerEntity,
"SOUND_SWITCH");
44 BaseMagazineComponent magazine = BaseMagazineComponent.Cast(pOwnerEntity.FindComponent(BaseMagazineComponent));
45 CharacterControllerComponent ctrl = CharacterControllerComponent.Cast(pUserEntity.FindComponent(CharacterControllerComponent));
48 bool bEmpty = storage.Get(0) ==
null;
49 ctrl.ReloadWeaponWith(pOwnerEntity, !bEmpty);
53 manager.EquipWeaponAttachment(pOwnerEntity, pUserEntity);
59 override bool CanBeShownScript(IEntity user)
64 if (!m_ItemComponent.GetParentSlot())
67 ChimeraCharacter character = ChimeraCharacter.Cast(
SCR_PlayerController.GetLocalControlledEntity());
71 CharacterControllerComponent controller = character.GetCharacterController();
75 if(!controller.GetInspect())
79 m_InventoryManager = SCR_InventoryStorageManagerComponent.Cast(character.FindComponent(SCR_InventoryStorageManagerComponent));
83 BaseWeaponManagerComponent weaponManager = controller.GetWeaponManagerComponent();
87 m_WeaponComponent = controller.GetWeaponManagerComponent().GetCurrentWeapon();
88 if(!m_WeaponComponent || m_WeaponComponent.GetOwner() == m_ItemComponent.GetParentSlot().GetOwner())
91 auto storage = WeaponAttachmentsStorageComponent.Cast(m_WeaponComponent.GetOwner().FindComponent(WeaponAttachmentsStorageComponent));
98 IEntity existingAttachment = storage.Get(0);
99 if (existingAttachment)
107 auto xstorage = WeaponAttachmentsStorageComponent.Cast(muzzleComp.GetOwner().FindComponent(WeaponAttachmentsStorageComponent));
113 IEntity existingAttachment = xstorage.Get(0);
114 if (existingAttachment)
116 if (existingAttachment ==
GetOwner())
127 override bool GetActionNameScript(out
string outName)
129 if (!m_ItemComponent)
132 UIInfo itemInfo = m_ItemComponent.GetUIInfo();
133 if (actionInfo && itemInfo)
135 outName =
string.Format(
"%1%2", actionInfo.GetName(), itemInfo.GetName());