Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InventoryHitZoneSlotUI.c
Go to the documentation of this file.
2 {
3  protected SCR_InventoryHitZonePointContainerUI m_pParentContainer;
4  protected bool m_bTourniquetted;
5 
6  //------------------------------------------------------------------------------------------------
7  override bool OnDrop(SCR_InventorySlotUI slot)
8  {
9  IEntity item = slot.GetInventoryItemComponent().GetOwner();
10  if (!item)
11  return true;
12 
13  if (!CanApplyItem(item))
14  return true;
15 
17  gadgetMgr.SetGadgetMode(item, EGadgetMode.IN_HAND);
18 
19  ChimeraCharacter character = ChimeraCharacter.Cast(m_Player);
20  SCR_CharacterControllerComponent charCtrl = SCR_CharacterControllerComponent.Cast(character.GetCharacterController());
21  if (charCtrl.GetRightHandItem() == item || charCtrl.GetAttachedGadgetAtLeftHandSlot() == item)
22  {
23  ApplyItem(item, true, false);
24  return true;
25  }
26 
27  charCtrl.m_OnGadgetStateChangedInvoker.Insert(ApplyItem);
28 
29  return true;
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  protected void ApplyItem(IEntity gadget, bool isInHand, bool isOnGround)
34  {
35  if (!m_pParentContainer)
36  return;
37 
38  if (!isInHand)
39  return;
40 
41  ChimeraCharacter character = ChimeraCharacter.Cast(m_Player);
42  InventoryItemComponent itemComp = InventoryItemComponent.Cast(gadget.FindComponent(InventoryItemComponent));
43 
44  SCR_CharacterControllerComponent charCtrl = SCR_CharacterControllerComponent.Cast(character.GetCharacterController());
45  SCR_ConsumableItemComponent comp = SCR_ConsumableItemComponent.Cast(gadget.FindComponent(SCR_ConsumableItemComponent));
46  SCR_ConsumableEffectHealthItems effect = SCR_ConsumableEffectHealthItems.Cast(comp.GetConsumableEffect());
47  if (!effect)
48  return;
49 
50  if (effect.ActivateEffect(character, character, gadget, effect.GetAnimationParameters(gadget, character, m_pParentContainer.GetHitZoneGroup())))
51  itemComp.RequestUserLock(character, true);
52 
53  charCtrl.m_OnGadgetStateChangedInvoker.Remove(ApplyItem);
54  }
55 
56  //------------------------------------------------------------------------------------------------
57  bool CanApplyItem(notnull IEntity item)
58  {
59  SCR_ConsumableItemComponent comp = SCR_ConsumableItemComponent.Cast(item.FindComponent(SCR_ConsumableItemComponent));
60  if (!comp)
61  return false;
62 
63  SCR_ConsumableEffectHealthItems effect = SCR_ConsumableEffectHealthItems.Cast(comp.GetConsumableEffect());
64 
65  return effect && effect.CanApplyEffectToHZ(m_Player, m_Player, m_pParentContainer.GetHitZoneGroup());
66  }
67 
68  void SetTourniquetted(bool tourniquetted)
69  {
70  m_bTourniquetted = tourniquetted;
71  }
72 
73  bool IsTourniquetted()
74  {
75  return m_bTourniquetted;
76  }
77 
78  SCR_InventoryMenuUI GetMenuHandler()
79  {
80  return m_pParentContainer.GetInventoryHandler();
81  }
82 
83  //------------------------------------------------------------------------------------------------
85  BaseInventoryStorageComponent storage,
86  LoadoutAreaType slotID = null,
87  SCR_InventoryMenuUI menuManager = null,
88  int iPage = 0,
89  array<BaseInventoryStorageComponent> aTraverseStorage = null,
90  SCR_InventoryHitZonePointContainerUI parent = null, bool isTourniquetted = false)
91  {
92  m_Storage = storage;
93  m_MenuHandler = menuManager;
94  m_eSlotAreaType = slotID;
95  m_iMaxRows = 1;
96  m_iMaxColumns = 1;
97  m_iMatrix = new SCR_Matrix(m_iMaxColumns, m_iMaxRows);
98  m_pParentContainer = parent;
99  m_bTourniquetted = isTourniquetted;
100  }
101 }
102 
103 //------------------------------------------------------------------------------------------------
104 class SCR_InventoryHitZoneSlotUI : SCR_InventorySlotUI
105 {
106  override bool OnDrop(SCR_InventorySlotUI slot)
107  {
108  return m_pStorageUI.OnDrop(slot);
109  }
110 }
SCR_InventoryAttachmentPointUI
void SCR_InventoryAttachmentPointUI(BaseInventoryStorageComponent storage, LoadoutAreaType slotID=null, SCR_InventoryMenuUI menuManager=null, int iPage=0, array< BaseInventoryStorageComponent > aTraverseStorage=null)
Definition: SCR_InventoryAttachmentStorageUI.c:140
SCR_ConsumableEffectHealthItems
Definition: SCR_ConsumableEffectHealthItems.c:2
OnDrop
SCR_InventoryHitZoneUI SCR_InventoryAttachmentPointUI OnDrop(SCR_InventorySlotUI slot)
Definition: SCR_InventoryHitZoneSlotUI.c:106
SCR_GadgetManagerComponent
Definition: SCR_GadgetManagerComponent.c:138
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
m_bTourniquetted
protected bool m_bTourniquetted
Definition: SCR_InventoryHitZoneSlotUI.c:3
m_Player
protected ChimeraCharacter m_Player
Definition: SCR_CampaignTutorialComponentArland.c:40
SCR_InventoryHitZoneUI
Definition: SCR_InventoryHitZoneSlotUI.c:1
SCR_InventoryMenuUI
Definition: SCR_InventoryMenuUI.c:247
InventoryItemComponent
Definition: InventoryItemComponent.c:12
SCR_Matrix
Definition: SCR_Matrix.c:2
LoadoutAreaType
Definition: LoadoutAreaType.c:12
m_MenuHandler
SCR_DeployMenuBase m_MenuHandler
Main deploy menu with the map present.
SCR_InventorySlotUI
Definition: SCR_InventorySlotUI.c:27
m_Storage
BaseInventoryStorageComponent m_Storage
Definition: SCR_TourniquetStorageComponent.c:10
SCR_InventoryHitZonePointContainerUI
Definition: SCR_InventoryHitZonePointUI.c:1
m_pParentContainer
protected SCR_InventoryHitZonePointContainerUI m_pParentContainer
Definition: SCR_InventoryHitZonePointUI.c:435