Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_GroupWeaponEntry.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
5 {
7  protected IEntity m_pOwner;
9  protected WeaponSlotComponent m_pWeaponSlotComponent;
10 
11  //------------------------------------------------------------------------------------------------
14  override void OnPerform(IEntity user, BaseSelectionMenu sourceMenu)
15  {
16  // We have no means of switching the weapons for our character
17  // if the controller component is null
18  auto pGenericOwner = GenericEntity.Cast(m_pOwner);
19  if (!pGenericOwner)
20  return;
21 
22  auto pCharacterController = CharacterControllerComponent.Cast(pGenericOwner.FindComponent(CharacterControllerComponent));
23  if (!pCharacterController)
24  return;
25 
27  pCharacterController.SelectWeapon(m_pWeaponSlotComponent);
28  }
29 
30  //------------------------------------------------------------------------------------------------
32  override void OnDonePerform(IEntity user, BaseSelectionMenu sourceMenu)
33  {
34 
35  }
36 
38  protected override bool CanBePerformedScript(IEntity user, BaseSelectionMenu sourceMenu)
39  {
40  if (m_pWeaponSlotComponent && m_pWeaponSlotComponent.GetWeaponEntity())
41  return true;
42 
43  return false;
44  }
45 
46  //------------------------------------------------------------------------------------------------
48  protected override UIInfo GetUIInfoScript()
49  {
50  if (m_pWeaponSlotComponent)
51  return m_pWeaponSlotComponent.GetUIInfo();
52 
53  return null;
54  }
55 
56  //------------------------------------------------------------------------------------------------
58  void SCR_GroupWeaponEntry(IEntity pOwner, WeaponSlotComponent pWeaponSlot)
59  {
60  // Assign the owner
61  m_pOwner = pOwner;
62 
63  // Assign weapon component
64  m_pWeaponSlotComponent = pWeaponSlot;
65  }
66 
67 };
UIInfo
UIInfo - declare object, allows to define UI elements.
Definition: UIInfo.c:13
SCR_GroupWeaponEntry
Definition: SCR_GroupWeaponEntry.c:4
WeaponSlotComponent
Definition: WeaponSlotComponent.c:12
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_BaseGroupEntry
An abstract wrapper to provide common interface for items that can be stored in a BaseGroup.
Definition: SCR_BaseGroupEntry.c:3
BaseSelectionMenu
Definition: BaseSelectionMenu.c:12