Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GroupWeaponEntry.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
5{
7 protected IEntity m_pOwner;
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 {
51 return m_pWeaponSlotComponent.GetUIInfo();
52
53 return null;
54 }
55
56 //------------------------------------------------------------------------------------------------
59 {
60 // Assign the owner
61 m_pOwner = pOwner;
62
63 // Assign weapon component
64 m_pWeaponSlotComponent = pWeaponSlot;
65 }
66
67};
An abstract wrapper to provide common interface for items that can be stored in a BaseGroup.
override bool CanBePerformedScript(IEntity user, BaseSelectionMenu sourceMenu)
Can this entry be performed?
override void OnPerform(IEntity user, BaseSelectionMenu sourceMenu)
override UIInfo GetUIInfoScript()
If target slot is valid, return its UI info.
IEntity m_pOwner
Owner of this group.
void SCR_GroupWeaponEntry(IEntity pOwner, WeaponSlotComponent pWeaponSlot)
Create new group representing a single weapon.
WeaponSlotComponent m_pWeaponSlotComponent
The weapon this entry represents.
override void OnDonePerform(IEntity user, BaseSelectionMenu sourceMenu)
Anything that should be done when item is deselected should be handled here.
UIInfo - allows to define UI elements.
Definition UIInfo.c:14