Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EquipWeaponAttachment.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  ChimeraCharacter m_Character;
6  GenericEntity m_Owner;
7  SCR_InventoryStorageManagerComponent m_InventoryManager;
8  InventoryItemComponent m_ItemComponent;
9 
10 
11  #ifndef DISABLE_INVENTORY
12  //------------------------------------------------------------------------------------------------
13  override protected void PerformActionInternal(SCR_InventoryStorageManagerComponent manager, IEntity pOwnerEntity, IEntity pUserEntity)
14  {
15  manager.EquipWeaponAttachment( pOwnerEntity, pUserEntity );
16  }
17 
18  //------------------------------------------------------------------------------------------------
19  override bool CanBeShownScript(IEntity user)
20  {
21  if(!m_Owner)
22  return false;
23 
24  if (!m_ItemComponent || m_ItemComponent.GetParentSlot() != null)
25  return false;
26 
27  if(!m_Character)
28  m_Character = ChimeraCharacter.Cast(SCR_PlayerController.GetLocalControlledEntity());
29  if(!m_Character)
30  return false;
31 
33  m_InventoryManager = SCR_InventoryStorageManagerComponent.Cast(m_Character.FindComponent(SCR_InventoryStorageManagerComponent));
35  return false;
36 
37  bool result = m_InventoryManager.CanInsertItem(m_Owner, EStoragePurpose.PURPOSE_ATTACHMENT_PROXY);
38 
39  return result;
40  }
41  #endif
42 
43  //------------------------------------------------------------------------------------------------
44  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
45  {
46  if(!m_Owner)
47  m_Owner = GenericEntity.Cast(pOwnerEntity);
48  if (m_Owner)
49  {
50  m_ItemComponent = InventoryItemComponent.Cast(m_Owner.FindComponent(InventoryItemComponent));
51  }
52  }
53 };
SCR_InventoryAction
modded version for to be used with the inventory 2.0
Definition: SCR_InventoryAction.c:3
SCR_PlayerController
Definition: SCR_PlayerController.c:31
m_InventoryManager
SCR_InventoryStorageManagerComponent m_InventoryManager
Definition: SCR_AttachementAction.c:15
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
InventoryItemComponent
Definition: InventoryItemComponent.c:12
EStoragePurpose
EStoragePurpose
Definition: EStoragePurpose.c:12
SCR_EquipWeaponAttachment
Equip weapon attachment.
Definition: SCR_EquipWeaponAttachment.c:3
m_Owner
SCR_AIGroupUtilityComponentClass m_Owner