Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InventoryStorageManagerComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/UI/Inventory", description: "[MOD] Inventory Slot UI class")]
3 {
4 }
5 
6 enum EInventoryRetCode
7 {
8  RETCODE_OK = 0,
11  RETCODE_DEFAULT_STATE = 0xFFFF
12 }
13 
14 enum ECallbackState
15 {
16  DROP = 0,
17  INSERT = 1,
18  MOVE = 2,
19  DELETE = 3,
20  FINAL = 4
21 }
22 
23 enum EResupplyUnavailableReason
24 {
25  //~ If multiple reasons for Resupply Unavailable than the Highst enum will be used
26  NONE,
27  NO_VALID_WEAPON = 10,
28  ENOUGH_ITEMS = 20,
29  NOT_IN_GIVEN_STORAGE = 30,
30  INVENTORY_FULL = 40,
31 
32  //~ Resupply was valid. Add invalid reasons above
33  RESUPPLY_VALID = 99999,
34 }
35 
36 class SCR_HoldableItemPredicate : InventorySearchPredicate
37 {
38  ECommonItemType wanted;
39 
40  //------------------------------------------------------------------------------------------------
41  // constructor
42  void SCR_HoldableItemPredicate()
43  {
44  QueryAttributeTypes.Insert(SCR_ItemOfInterestAttribute);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
49  {
50  SCR_ItemOfInterestAttribute optionalAttribute = SCR_ItemOfInterestAttribute.Cast(queriedAttributes[0]);
51  return optionalAttribute.GetInterestType() == wanted;
52  }
53 }
54 
55 class SCR_BandagePredicate : InventorySearchPredicate
56 {
57  //------------------------------------------------------------------------------------------------
58  // constructor
59  void SCR_BandagePredicate()
60  {
61  QueryComponentTypes.Insert(SCR_ConsumableItemComponent);
62  }
63 
64  //------------------------------------------------------------------------------------------------
65  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
66  {
67  return (SCR_ConsumableItemComponent.Cast(queriedComponents[0])).GetConsumableType() == SCR_EConsumableType.BANDAGE;
68  }
69 }
70 
71 class SCR_ApplicableMedicalItemPredicate : InventorySearchPredicate
72 {
73  IEntity characterEntity;
74  ECharacterHitZoneGroup hitZoneGroup;
75 
76  //------------------------------------------------------------------------------------------------
77  // constructor
78  void SCR_ApplicableMedicalItemPredicate()
79  {
80  QueryComponentTypes.Insert(SCR_ConsumableItemComponent);
81  }
82 
83  //------------------------------------------------------------------------------------------------
84  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
85  {
86  SCR_EConsumableType type = SCR_ConsumableItemComponent.Cast(queriedComponents[0]).GetConsumableType();
87  bool isMatch = (type == SCR_EConsumableType.BANDAGE)
88  || (type == SCR_EConsumableType.HEALTH)
89  || (type == SCR_EConsumableType.TOURNIQUET)
90  || (type == SCR_EConsumableType.SALINE)
91  || (type == SCR_EConsumableType.MORPHINE);
92 
93  if (!isMatch)
94  return false;
95 
96  SCR_ConsumableItemComponent medicalItem = SCR_ConsumableItemComponent.Cast(item.FindComponent(SCR_ConsumableItemComponent));
97  SCR_ConsumableEffectHealthItems effect = SCR_ConsumableEffectHealthItems.Cast(medicalItem.GetConsumableEffect());
98  if (!effect)
99  return false;
100 
101  return effect.CanApplyEffectToHZ(characterEntity, characterEntity, hitZoneGroup);
102  }
103 }
104 
105 class SCR_ItemTypeSearchPredicate : InventorySearchPredicate
106 {
107  int m_iItemType = -1;
108  IEntity m_iOriginalItem;
109 
110  //------------------------------------------------------------------------------------------------
111  // constructor
115  void SCR_ItemTypeSearchPredicate(typename type, int wantedItemType, IEntity originalItem)
116  {
117  QueryComponentTypes.Insert(type);
118  m_iItemType = wantedItemType;
119  }
120 
121  //------------------------------------------------------------------------------------------------
122  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
123  {
124  return (item != m_iOriginalItem) && (SCR_CharacterInventoryStorageComponent.GetItemType(item) == m_iItemType);
125  }
126 }
127 
129 class SCR_CompatibleAttachmentPredicate : InventorySearchPredicate
130 {
131  typename attachmentType;
132 
133  //------------------------------------------------------------------------------------------------
134  // constructor
135  void SCR_CompatibleAttachmentPredicate()
136  {
137  QueryComponentTypes.Insert(InventoryItemComponent);
138  }
139 
140  //------------------------------------------------------------------------------------------------
141  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
142  {
143  InventoryItemComponent itemComp = InventoryItemComponent.Cast(queriedComponents[0]);
144 
145  if (!itemComp)
146  return false;
147 
148  ItemAttributeCollection itemAttributes = itemComp.GetAttributes();
149  if (!itemAttributes)
150  return false;
151 
152  WeaponAttachmentAttributes itemAttribute = WeaponAttachmentAttributes.Cast(itemAttributes.FindAttribute(WeaponAttachmentAttributes));
153  if (!itemAttribute)
154  return false;
155 
156  BaseAttachmentType itemAttachmentType = itemAttribute.GetAttachmentType();
157  if (!itemAttachmentType)
158  return false;
159 
160  typename itemAttachmentTypename = itemAttachmentType.Type();
161  if (!itemAttachmentTypename)
162  return false;
163 
164  return itemAttachmentTypename.IsInherited(attachmentType); // Check if attachment types match
165  }
166 }
167 
168 class SCR_SalinePredicate : InventorySearchPredicate
169 {
170  //------------------------------------------------------------------------------------------------
171  // constructor
172  void SCR_SalinePredicate()
173  {
174  QueryComponentTypes.Insert(SCR_ConsumableItemComponent);
175  }
176 
177  //------------------------------------------------------------------------------------------------
178  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
179  {
180  if (storage.Type().IsInherited(EquipmentStorageComponent))
181  return true;
182 
183  return false;
184  }
185 }
186 
188 class SCR_MagazinePredicate : InventorySearchPredicate
189 {
190  typename magWellType;
191 
192  //------------------------------------------------------------------------------------------------
193  // constructor
194  void SCR_MagazinePredicate()
195  {
196  QueryComponentTypes.Insert(BaseMagazineComponent);
197  }
198 
199  //------------------------------------------------------------------------------------------------
200  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
201  {
202  BaseMagazineComponent iMag = BaseMagazineComponent.Cast(queriedComponents[0]);
203  if (!iMag)
204  return false;
205 
206  BaseMagazineWell iMagWell = iMag.GetMagazineWell();
207  if (!iMagWell)
208  return false;
209 
210  return (iMagWell.IsInherited(magWellType)); // Check if magwells match
211  }
212 }
213 
215 class SCR_PrefabNamePredicate : InventorySearchPredicate
216 {
217  string prefabName;
218 
219  //------------------------------------------------------------------------------------------------
220  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
221  {
222  EntityPrefabData pd = item.GetPrefabData();
223  return pd.GetPrefabName() == this.prefabName;
224  }
225 }
226 
228 class SCR_PrefabDataPredicate : InventorySearchPredicate
229 {
230  EntityPrefabData prefabData;
231 
232  //------------------------------------------------------------------------------------------------
233  override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
234  {
235  return item.GetPrefabData() == this.prefabData;
236  }
237 }
238 
239 class DropAndMoveOperationCallback : ScriptedInventoryOperationCallback
240 {
241  InventoryItemComponent m_ItemBefore;
242  InventoryItemComponent m_ItemAfter;
243  InventoryStorageSlot m_TargetSlot;
244  SCR_InventoryStorageManagerComponent m_Manager;
245  SCR_InvCallBack m_FinalCB;
246  bool m_bIstakenFromArsenal;
247  bool m_bDeleteItemIfEmpty;
248  ref array<IEntity> m_aItemsToMove = {};
249  ECallbackState m_ECurrentState = 0; // 0 - drop, 1 - insert, 2 - move, 3 - delete, 4 - final
250 
251  //------------------------------------------------------------------------------------------------
252  override protected void OnComplete()
253  {
254  switch (m_ECurrentState)
255  {
256  case ECallbackState.DROP:
257  {
258  OnDropComplete();
259  }
260  break;
261 
262  case ECallbackState.INSERT:
263  {
264  OnInsertComplete();
265  }
266  break;
267 
268  case ECallbackState.MOVE:
269  {
270  OnMoveComplete();
271  }
272  break;
273 
274  case ECallbackState.DELETE:
275  {
276  OnDeleteComplete();
277  }
278  break;
279 
280  case ECallbackState.FINAL:
281  {
282  OnFinalState();
283  }
284  break;
285  }
286  }
287 
288  //------------------------------------------------------------------------------------------------
289  protected void OnDropComplete()
290  {
291  m_ECurrentState++;
292  m_Manager.TryMoveItemToStorage(m_ItemAfter.GetOwner(), m_TargetSlot.GetStorage(), m_TargetSlot.GetID(), this);
293  }
294 
295  //------------------------------------------------------------------------------------------------
296  protected void OnInsertComplete()
297  {
298  if (!m_bIstakenFromArsenal)
299  {
300  m_ECurrentState = ECallbackState.FINAL;
301  OnFinalState();
302  return;
303  }
304 
305  m_ECurrentState++;
306  //BaseInventoryStorageComponent itemIsStorage = BaseInventoryStorageComponent.Cast(m_ItemBefore);
307  //m_Manager.GetAllItems(m_aItemsToMove, itemIsStorage);
308  OnMoveComplete();
309  }
310 
311  //------------------------------------------------------------------------------------------------
312  protected void OnMoveComplete()
313  {
314  // Temporarily disabled for performance reasons. Once it gets fixed the transfer of items can be reenabled.
315 // if (m_aItemsToMove.Count() == 0)
316 // {
317 // m_ECurrentState++;
318 // OnDeleteComplete();
319 // return;
320 // }
321 // IEntity item = m_aItemsToMove[m_aItemsToMove.Count() - 1];
322 // m_aItemsToMove.Resize(m_aItemsToMove.Count() - 1);
323 // BaseInventoryStorageComponent storage = m_Manager.FindStorageForItem(item, EStoragePurpose.PURPOSE_ANY);
324 // if (!m_Manager.TryMoveItemToStorage(item, storage, -1, this))
325 // OnMoveComplete();
326 
327  if (m_bDeleteItemIfEmpty)
328  {
329  m_ECurrentState++;
330  OnDeleteComplete();
331  }
332  else
333  {
334  m_ECurrentState = ECallbackState.FINAL;
335  OnFinalState();
336  }
337 
338  return;
339  }
340 
341  //------------------------------------------------------------------------------------------------
342  protected void OnDeleteComplete()
343  {
344  m_aItemsToMove.Clear();
345  BaseInventoryStorageComponent itemIsStorage = BaseInventoryStorageComponent.Cast(m_ItemBefore);
346  m_Manager.GetAllItems(m_aItemsToMove, itemIsStorage);
347 
348  if (m_aItemsToMove.IsEmpty())
349  m_Manager.AskServerToDeleteEntity(m_ItemBefore.GetOwner());
350 
351  OnFinalState();
352  }
353 
354  //------------------------------------------------------------------------------------------------
355  protected void OnFinalState()
356  {
357  if (m_FinalCB)
358  m_FinalCB.InternalComplete();
359  }
360 }
361 
362 class SCR_ResupplyMagazinesCallback : ScriptedInventoryOperationCallback
363 {
364  protected SCR_InventoryStorageManagerComponent m_Manager;
365  protected ref map<ResourceName, int> m_MagazinesToSpawn = new map<ResourceName, int>();
366 
367  //------------------------------------------------------------------------------------------------
371  void Insert(ResourceName prefab, int count)
372  {
373  int currentCount;
374  m_MagazinesToSpawn.Find(prefab, currentCount);
375  m_MagazinesToSpawn.Insert(prefab, currentCount + count);
376  }
377 
378  //------------------------------------------------------------------------------------------------
380  void Start()
381  {
382  OnComplete();
383  }
384 
385  //------------------------------------------------------------------------------------------------
386  override protected void OnComplete()
387  {
388  if (!m_Manager)
389  return;
390 
391  if (!m_MagazinesToSpawn.IsEmpty())
392  {
393  //--- Next item to process
394  ResourceName prefab = m_MagazinesToSpawn.GetKey(0);
395  int count = m_MagazinesToSpawn.GetElement(0);
396  count--;
397 
398  if (count == 0)
399  m_MagazinesToSpawn.Remove(prefab);
400  else
401  m_MagazinesToSpawn.Set(prefab, count);
402 
403  m_Manager.TrySpawnPrefabToStorage(prefab, cb: this);
404  }
405  else
406  {
407  //--- All processed
408  OnFailed();
409  }
410  }
411 
412  //------------------------------------------------------------------------------------------------
413  override protected void OnFailed()
414  {
415  //--- Delete itself (after a delay - can't delete itself at this frame)
416  GetGame().GetCallqueue().CallLater(m_Manager.EndResupplyMagazines, 1, false);
417  }
418 
419  //------------------------------------------------------------------------------------------------
420  // constructor
422  void SCR_ResupplyMagazinesCallback(SCR_InventoryStorageManagerComponent manager)
423  {
424  m_Manager = manager;
425  }
426 }
427 
428 class SCR_InventoryStorageManagerComponent : ScriptedInventoryStorageManagerComponent
429 {
430  private SCR_CharacterInventoryStorageComponent m_Storage;
432  private ref SCR_BandagePredicate m_BandagePredicate = new SCR_BandagePredicate();
433  protected EInventoryRetCode m_ERetCode;
434  protected int m_iHealthEquipment = 0;
435  protected bool m_bIsInventoryLocked = false;
436  protected ref SCR_WeaponSwitchingBaseUI m_pWeaponSwitchingUI;
437  private bool m_bWasRaised;
438  private IEntity m_StorageToOpen;
439  protected ref SCR_ResupplyMagazinesCallback m_ResupplyMagazineCallback;
440 
441  ref ScriptInvokerBool m_OnInventoryOpenInvoker = new ScriptInvokerBool();
442  ref ScriptInvokerBool m_OnQuickBarOpenInvoker = new ScriptInvokerBool();
443 
444  //------------------------------------------------------------------------------------------------
448  int GetAllRootItems(out notnull array<IEntity> rootItems)
449  {
450  rootItems.Clear();
451  array<BaseInventoryStorageComponent> storages = {};
452 
453  //~ Get deposits like backpacks and jackets as well as any held weapons
454  GetStorages(storages, EStoragePurpose.PURPOSE_DEPOSIT);
455  GetStorages(storages, EStoragePurpose.PURPOSE_WEAPON_PROXY);
456 
457  array<IEntity> items = {};
458  array<BaseInventoryStorageComponent> clothStorages;
459  foreach (BaseInventoryStorageComponent storage : storages)
460  {
461  //~ If backpack or jacked or any other cloth storage only get what is inside the storage
462  if (ClothNodeStorageComponent.Cast(storage))
463  {
464  if (!storage)
465  continue;
466 
467  clothStorages = {};
468  storage.GetOwnedStorages(clothStorages, 1, false);
469 
470  foreach (BaseInventoryStorageComponent clothStorage : clothStorages)
471  {
472  if (!clothStorage)
473  continue;
474 
475  clothStorage.GetAll(items);
476  rootItems.Copy(items);
477  }
478 
479  continue;
480  }
481  else
482  {
483  storage.GetAll(items);
484  rootItems.Copy(items);
485  }
486  }
487 
488  return rootItems.Count();
489  }
490 
491  //------------------------------------------------------------------------------------------------
492  // Callback when item is added (will be performed locally after server completed the Insert/Move operation)
493  override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)
494  {
495  super.OnItemAdded(storageOwner, item);
496 
497  SCR_ConsumableItemComponent consumable = SCR_ConsumableItemComponent.Cast(item.FindComponent(SCR_ConsumableItemComponent));
498  if ( consumable && consumable.GetConsumableType() == SCR_EConsumableType.BANDAGE )
499  m_iHealthEquipment++; //store count of the health components
500  }
501 
502  //------------------------------------------------------------------------------------------------
503  // Callback when item is removed (will be performed locally after server completed the Remove/Move operation)
504  override protected void OnItemRemoved(BaseInventoryStorageComponent storageOwner, IEntity item)
505  {
506  super.OnItemRemoved(storageOwner, item);
507 
508  SCR_ConsumableItemComponent consumable = SCR_ConsumableItemComponent.Cast(item.FindComponent(SCR_ConsumableItemComponent));
509  if ( consumable && consumable.GetConsumableType() == SCR_EConsumableType.BANDAGE )
510  m_iHealthEquipment--; //store count of the health components
511  }
512 
513  //------------------------------------------------------------------------------------------------
514  override protected bool ShouldForbidRemoveByInstigator(InventoryStorageManagerComponent instigatorManager, BaseInventoryStorageComponent fromStorage, IEntity item)
515  {
516  //in case of health items, permit medics to donate healing items to targets
517  SCR_ConsumableItemComponent consumableItemComp = SCR_ConsumableItemComponent.Cast(item.FindComponent(SCR_ConsumableItemComponent));
518  if (consumableItemComp)
519  return false;
520 
521  if (m_CharacterController && m_CharacterController.GetLifeState() == ECharacterLifeState.ALIVE)
522  return true;
523 
524  return false;
525  }
526 
527  //------------------------------------------------------------------------------------------------
531  void PlayItemSound(IEntity entity, string soundEvent)
532  {
533  if (!entity)
534  return;
535 
536  RplComponent rplComp = RplComponent.Cast(entity.FindComponent(RplComponent));
537  if (rplComp)
538  {
539  Rpc(RpcAsk_PlaySound, rplComp.Id(), soundEvent);
540  }
541  else
542  {
543  SoundComponent soundComp = SoundComponent.Cast(entity.FindComponent(SoundComponent));
544  if (soundComp)
545  {
546  soundComp.SoundEvent(soundEvent);
547  }
548  else
549  {
550  SCR_SoundManagerEntity soundManagerEntity = GetGame().GetSoundManagerEntity();
551  if (!soundManagerEntity)
552  return;
553 
554  soundManagerEntity.CreateAndPlayAudioSource(entity, soundEvent);
555  }
556  }
557  }
558 
559  //------------------------------------------------------------------------------------------------
563  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
564  void RpcAsk_PlaySound(RplId targetRplId, string soundAction)
565  {
566  Rpc(RpcDo_PlaySound, targetRplId, soundAction);
567  RpcDo_PlaySound(targetRplId, soundAction);
568  }
569 
570  //------------------------------------------------------------------------------------------------
574  [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
575  void RpcDo_PlaySound(RplId targetRplId, string soundAction)
576  {
577  RplComponent rplComp = RplComponent.Cast(Replication.FindItem(targetRplId));
578  if (!rplComp)
579  return;
580 
581  IEntity entity = rplComp.GetEntity();
582  if (!entity)
583  return;
584 
585  SoundComponent soundComp = SoundComponent.Cast(entity.FindComponent(SoundComponent));
586  if (soundComp)
587  {
588  soundComp.SoundEvent(soundAction);
589  }
590  else
591  {
592  SCR_SoundManagerEntity soundManagerEntity = GetGame().GetSoundManagerEntity();
593  if (!soundManagerEntity)
594  return;
595 
596  soundManagerEntity.CreateAndPlayAudioSource(entity, soundAction);
597  }
598  }
599 
600 #ifndef DISABLE_INVENTORY
601 
602  //------------------------------------------------------------------------------------------------
604  SCR_CharacterInventoryStorageComponent GetCharacterStorage()
605  {
606  return m_Storage;
607  }
608 
609  //------------------------------------------------------------------------------------------------
615  // TODO: make this method as native (cannot override the proto native CanMoveItemToStorage)
616  bool CanInsertItemInActualStorage(IEntity item, BaseInventoryStorageComponent storage, int slotID = -1)
617  {
618  if (!IsAnimationReady() || IsInventoryLocked())
619  return false;
620 
621  array<BaseInventoryStorageComponent> pStorages = {};
622  storage.GetOwnedStorages( pStorages, 1, false );
623  pStorages.Insert( storage );
624 
625  foreach ( BaseInventoryStorageComponent pStorage : pStorages )
626  {
627  bool bCanInsert = CanInsertItemInStorage( item, pStorage, -1 ); //split because of debug purposes
628  bool bCanMove = CanMoveItemToStorage( item, pStorage, -1 );
629  if ( bCanInsert || bCanMove )
630  return true;
631  }
632  return false;
633  }
634 
635  //------------------------------------------------------------------------------------------------
636  // ! The return code informs about the state of the operation ( i.e. cannot insert item, since it is too large )
637  // ! it clear the flag
639  void SetReturnCode( EInventoryRetCode ERetCode )
640  {
641  m_ERetCode &= ~ERetCode;
642  }
643 
644  //------------------------------------------------------------------------------------------------
645  // ! The return code informs about the state of the operation ( i.e. cannot insert item, since it is too large )
646  // ! it clear the flag
647  void SetReturnCodeDefault()
648  {
649  m_ERetCode = EInventoryRetCode.RETCODE_DEFAULT_STATE;
650  }
651 
652  //------------------------------------------------------------------------------------------------
654  EInventoryRetCode GetReturnCode()
655  {
656  return m_ERetCode;
657  }
658 
659  //------------------------------------------------------------------------------------------------
661  float GetTotalWeightOfAllStorages()
662  {
663  array<BaseInventoryStorageComponent> storages = {};
664  float fTotalWeight = 0.0;
665 
666  //TODO: actually not a very good way how to get storages, but using the GetStorages() method causes the weight being doubled. We need to get just the "parent" storages
667  storages.Insert(m_Storage.GetWeaponStorage());
668  storages.Insert(m_Storage);
669 
670  foreach (BaseInventoryStorageComponent storage : storages)
671  {
672  fTotalWeight += storage.GetTotalWeight();
673  }
674 
675  return fTotalWeight;
676  }
677 
678  //------------------------------------------------------------------------------------------------
680  void SetLootStorage( IEntity pOwner )
681  {
682  if (m_Storage)
683  m_Storage.SetLootStorage(pOwner);
684  }
685 
686  //------------------------------------------------------------------------------------------------
692  void InsertItem( IEntity pItem, BaseInventoryStorageComponent pStorageTo = null, BaseInventoryStorageComponent pStorageFrom = null, SCR_InvCallBack cb = null )
693  {
694  if (!pItem || !IsAnimationReady() || IsInventoryLocked())
695  return;
696 
697  SetInventoryLocked(true);
698 
699  bool canInsert = true;
700  if ( !pStorageTo ) // no storage selected, put it into best fitting storage
701  {
702  string soundEvent = SCR_SoundEvent.SOUND_EQUIP;
703  //TryInsertItem( pItem, EStoragePurpose.PURPOSE_DEPOSIT); // works for the owned storages ( not for the vicinity storages )
704  if ( !TryInsertItem( pItem, EStoragePurpose.PURPOSE_WEAPON_PROXY, cb ) )
705  {
706  if ( !TryInsertItem( pItem, EStoragePurpose.PURPOSE_DEPOSIT, cb ) )
707  {
708  if ( !TryMoveItemToStorage( pItem, FindStorageForItem( pItem, EStoragePurpose.PURPOSE_ANY ), -1, cb ) )
709  canInsert = TryMoveItemToStorage(pItem, m_Storage, -1, cb); // clothes from storage in vicinity
710  else
711  soundEvent = SCR_SoundEvent.SOUND_PICK_UP; // play pick up sound for everything else
712 
713  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_HOTKEY_CONFIRM);
714  }
715  else
716  soundEvent = SCR_SoundEvent.SOUND_PICK_UP;
717  }
718 
719  if (canInsert)
720  PlayItemSound(pItem, soundEvent);
721  }
722  else
723  {
724  if (pStorageTo == m_Storage)
725  {
726  canInsert = TryReplaceItem( pStorageTo, pItem, 0, cb );
727  if (canInsert)
728  {
729  SetInventoryLocked(false);
730  return;
731  }
732  }
733 
734  //~ Find a valid storage to insert item in
735  BaseInventoryStorageComponent validStorage = FindStorageForInsert( pItem, pStorageTo, EStoragePurpose.PURPOSE_ANY );
736  if (validStorage)
737  {
738  pStorageTo = validStorage;
739  }
740  //~ Check if item can be inserted in linked storages
741  else
742  {
743  //~ Find valid storage in linked storages
745  if (universalStorage)
746  {
747  array<BaseInventoryStorageComponent> linkedStorages = {};
748  universalStorage.GetLinkedStorages(linkedStorages);
749 
750  foreach(BaseInventoryStorageComponent linkedStorage : linkedStorages)
751  {
752  //~ Valid linked storage found
753  if (FindStorageForInsert(pItem, linkedStorage, EStoragePurpose.PURPOSE_ANY))
754  {
755  pStorageTo = linkedStorage;
756  break;
757  }
758  }
759  }
760  }
761 
762  if ( !pStorageFrom )
763  canInsert = TryInsertItemInStorage( pItem, pStorageTo, -1, cb ); // if we move item from ground to opened storage
764  else
765  canInsert = TryMoveItemToStorage( pItem, pStorageTo, -1, cb ); // if we move item between storages
766  }
767 
768  if (!canInsert)
769  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_DROP_ERROR);
770  else
771  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_DIFR_DROP);
772 
773  if (m_CharacterController && canInsert && !pStorageFrom)
774  m_CharacterController.TryPlayItemGesture(EItemGesture.EItemGesturePickUp);
775 
776  SetInventoryLocked(false);
777  }
778 
779  //------------------------------------------------------------------------------------------------
785  bool TryRemoveItemFromInventory(IEntity pItem, BaseInventoryStorageComponent storage = null, InventoryOperationCallback cb = null)
786  {
787  if (!CanMoveItem(pItem))
788  return false;
789 
790  if (!storage)
791  {
792  InventoryItemComponent itemComp = InventoryItemComponent.Cast(pItem.FindComponent(InventoryItemComponent));
793  if (!itemComp)
794  return false;
795 
796  InventoryStorageSlot parentSlot = itemComp.GetParentSlot();
797  if (parentSlot)
798  storage = parentSlot.GetStorage();
799  }
800 
801  SetInventoryLocked(true);
802  bool result = TryRemoveItemFromStorage(pItem, storage, cb);
803  SetInventoryLocked(false);
804 
805  return result;
806  }
807 
808  //------------------------------------------------------------------------------------------------
812  bool CanMoveItem(IEntity item)
813  {
814  if (!item || item.IsDeleted() || !IsAnimationReady() || IsInventoryLocked())
815  return false;
816 
817  return true;
818  }
819 
820 // //------------------------------------------------------------------------------------------------
821 // override bool TryInsertItemInStorageScr( IEntity pItem, BaseInventoryStorageComponent pStorageTo, int slotID = -1, InventoryOperationCallback cb = null )
822 // {
823 //
824 // if ( !pStorageTo )
825 // return;
826 //
827 // array<BaseInventoryStorageComponent> pStorages = {};
828 // pStorage.GetOwnedStorages( pStorages, 1, false ); // get all the storages, the storage has attached to it
829 // pStorages.Insert( pStorage ); // and put there also the storage
830 // foreach ( BaseInventoryStorageComponent tmpStorage : pStorages )
831 // {
832 // if ( MoveOperation( itemComponent, tmpStorage ) )
833 // {
834 // bRet = true;
835 // break;
836 // }
837 // }
838 // }
839 
840  //------------------------------------------------------------------------------------------------
846  bool TrySwapItems( IEntity pOwnerEntity, BaseInventoryStorageComponent pStorageTo, SCR_InvCallBack cb = null )
847  {
848  if ( !pStorageTo )
849  return false;
850 
851  InventoryStorageSlot slot = pStorageTo.FindSuitableSlotForItem( pOwnerEntity );
852  if ( !slot )
853  return false;
854 
855  if ( slot.GetAttachedEntity() )
856  {
857  if (!TrySwapItemStorages( pOwnerEntity, slot.GetAttachedEntity(), cb ))
858  {
859  CharacterHandWeaponSlotComponent handWeaponSlot = CharacterHandWeaponSlotComponent.Cast(slot.GetParentContainer());
860  //Move
861  if (handWeaponSlot)
862  {
863  if (TryRemoveItemFromInventory(slot.GetAttachedEntity()))
864  {
865  TryInsertItem(pOwnerEntity, EStoragePurpose.PURPOSE_ANY, cb);
866  return true;
867  }
868  }
869 
870  return false;
871  }
872 
873  return true;
874  }
875  else
876  {
877  return TryMoveItemToStorage( pOwnerEntity, pStorageTo, slot.GetID(), cb );
878  }
879 
880  return false;
881  }
882 
883  //------------------------------------------------------------------------------------------------
888  void EquipWeapon( IEntity pOwnerEntity, SCR_InvCallBack cb = null, bool bFromVicinity = true )
889  {
890  if ( !bFromVicinity )
891  {
892  if (!TrySwapItems(pOwnerEntity, m_Storage.GetWeaponStorage(), cb))
893  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_DROP_ERROR);
894  else
895  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_DIFR_DROP);
896 
897  return;
898  }
899 
900  IEntity user = GetOwner();
901  if (!user)
902  return;
903 
904  BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(user.FindComponent(BaseWeaponManagerComponent));
905  if (!weaponManager)
906  return;
907 
908  WeaponSlotComponent slot = weaponManager.GetCurrentSlot();
909  int preferred = 0;
910  if ( slot )
911  preferred = slot.GetWeaponSlotIndex();
912 
913  if (!EquipAny(m_Storage.GetWeaponStorage(), pOwnerEntity, preferred, cb))
914  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_DROP_ERROR);
915 
916  if (cb && cb.m_pStorageFrom != cb.m_pStorageTo)
917  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_DIFR_DROP);
918  else
919  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_SAME_DROP);
920 
921  // Play sound
922  PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
923  }
924 
925  //------------------------------------------------------------------------------------------------
930  void EquipWeaponAttachment( IEntity pOwnerEntity, IEntity pUserEntity, SCR_InvCallBack cb = null )
931  {
932  BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(pUserEntity.FindComponent(BaseWeaponManagerComponent));
933  if (!weaponManager)
934  return;
935 
936  WeaponSlotComponent slot = weaponManager.GetCurrentSlot();
937  if (!slot)
938  return;
939 
940  IEntity weaponEntity = slot.GetWeaponEntity();
941  if (!weaponEntity)
942  return;
943 
944  BaseInventoryStorageComponent storage = BaseInventoryStorageComponent.Cast(weaponEntity.FindComponent(BaseInventoryStorageComponent));
945  if (!storage)
946  return;
947 
948  EquipAny(storage, pOwnerEntity, -1, cb );
949 
950  // Play sound
951  PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
952  }
953 
954  //------------------------------------------------------------------------------------------------
958  void EquipGadget( IEntity pOwnerEntity, SCR_InvCallBack cb = null )
959  {
960  //(kamil) the gadget slots are now present directly on individual clothing items - will have to revise logic here if swapping is wanted
961  BaseInventoryStorageComponent storageComp = FindStorageForItem(pOwnerEntity, EStoragePurpose.PURPOSE_EQUIPMENT_ATTACHMENT);
962  if (storageComp)
963  {
964  EquipAny( storageComp, pOwnerEntity, -1, cb );
965 
966  // Play sound
967  PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
968  }
969  }
970 
971  //------------------------------------------------------------------------------------------------
974  void EquipCloth( IEntity pOwnerEntity )
975  {
976  // m_pStorage because character storage is inherited from SCR_EquipedLoadoutStorageComponent
977  EquipAny(m_Storage, pOwnerEntity);
978 
979  // Play sound
980  PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
981  }
982 
983  //------------------------------------------------------------------------------------------------
990  bool EquipAny(BaseInventoryStorageComponent storage, IEntity item, int preferred = -1, SCR_InvCallBack cb = null)
991  {
992  if (!storage || !item)
993  return false;
994  InventoryItemComponent itemComp = InventoryItemComponent.Cast(item.FindComponent(InventoryItemComponent));
995  if (!itemComp)
996  return false;
997 
998  InventoryStorageSlot m_TargetSlot = storage.FindSuitableSlotForItem(item);
999  // Storage doesn't have suitable slot for item (therefore any future opearation would fail)
1000  if (!m_TargetSlot)
1001  return false;
1002 
1003  if (preferred > 0 && preferred < storage.GetSlotsCount())
1004  m_TargetSlot = storage.GetSlot(preferred);
1005  else
1006  preferred = m_TargetSlot.GetID();
1007 
1008  InventoryStorageSlot sourceSlot = itemComp.GetParentSlot();
1009  // Item is on the ground as it does not belong to any storage (eg is not in the slot)
1010  if (!sourceSlot || !sourceSlot.GetStorage())
1011  {
1012  // we are picking up item from ground
1013  // if target slot is not empty return the result of replace operation
1014  if (m_TargetSlot.GetAttachedEntity())
1015  return TryReplaceItem(item, storage, preferred, cb);
1016 
1017  // we are picking up item from ground into empty slot, simply return result of the insert operation
1018  return TryInsertItemInStorage(item, storage, preferred, cb);
1019  }
1020 
1021  // our target slot is empty and we moving item from another storage
1022  // simply return the result of move operation
1023  if (!m_TargetSlot.GetAttachedEntity())
1024  return TryMoveItemToStorage(item, storage, preferred, cb);
1025 
1026  BaseInventoryStorageComponent sourceStorage = sourceSlot.GetStorage();
1027  bool isTakenFromArsenal = sourceStorage.GetOwner().FindComponent(SCR_ArsenalComponent);
1028  bool isTakenFromBody = false;
1029 
1030  ChimeraCharacter lootedBodyCharacter = ChimeraCharacter.Cast(sourceStorage.GetOwner());
1031  DamageManagerComponent lootedBodyDamageManager;
1032 
1033  if (lootedBodyCharacter)
1034  lootedBodyDamageManager = lootedBodyCharacter.GetDamageManager();
1035 
1036  if (lootedBodyDamageManager)
1037  isTakenFromBody = lootedBodyDamageManager.GetState() == EDamageState.DESTROYED;
1038 
1039  bool performDropOfOriginalItem = isTakenFromBody || isTakenFromArsenal || sourceStorage.GetOwner().FindComponent(SCR_CampaignArmoryStorageComponent) ;
1040 
1041  // If we don't want to drop item
1042  if (performDropOfOriginalItem)
1043  {
1044  // if we want to drop originally equipped item
1045  // here sequence would be as follows:
1046  // 1 - drop original item
1047  // 2 - insert item to target storage
1048  // 3 - try move as many items as possible from dropped item back to inventory
1049  // 4 - delete dropped item
1050 
1051  // At first - let's validate if this is even possible
1052  if (!CanSwapItemStorages(item, m_TargetSlot.GetAttachedEntity()))
1053  return false;
1054 
1055  DropAndMoveOperationCallback chainedCallback = new DropAndMoveOperationCallback();
1056  chainedCallback.m_Manager = this;
1057  chainedCallback.m_ItemAfter = itemComp;
1058  chainedCallback.m_ItemBefore = InventoryItemComponent.Cast(m_TargetSlot.GetAttachedEntity().FindComponent(InventoryItemComponent));
1059  chainedCallback.m_TargetSlot = m_TargetSlot;
1060  chainedCallback.m_FinalCB = cb;
1061  chainedCallback.m_bDeleteItemIfEmpty = true;
1062  chainedCallback.m_bIstakenFromArsenal = isTakenFromArsenal;
1063 
1064  return TryRemoveItemFromStorage(m_TargetSlot.GetAttachedEntity(), m_TargetSlot.GetStorage(), chainedCallback);
1065  }
1066 
1067  // we return the result of swap opoeration were item from slotA will be transfered to slotB and item from slotB to slotA
1068  return TrySwapItemStorages(item, m_TargetSlot.GetAttachedEntity(), cb);
1069  }
1070 
1071  //------------------------------------------------------------------------------------------------
1080  bool TryReplaceAndDropItemAtSlot(BaseInventoryStorageComponent storage, IEntity item, int slotID, SCR_InvCallBack cb = null, bool isTakenFromArsenal = false, bool deleteOriginalItemIfEmpty = false)
1081  {
1082  if (!storage || !item)
1083  return false;
1084  InventoryItemComponent itemComp = InventoryItemComponent.Cast(item.FindComponent(InventoryItemComponent));
1085  if (!itemComp)
1086  return false;
1087 
1088  InventoryStorageSlot m_TargetSlot = storage.GetSlot(slotID);
1089  // Storage doesn't have suitable slot for item (therefore any future opearation would fail)
1090  if (!m_TargetSlot)
1091  return false;
1092 
1093  InventoryStorageSlot sourceSlot = itemComp.GetParentSlot();
1094  // Item is on the ground as it does not belong to any storage (eg is not in the slot)
1095  if (!sourceSlot || !sourceSlot.GetStorage())
1096  {
1097  // we are picking up item from ground
1098  // if target slot is not empty return the result of replace operation
1099  if (m_TargetSlot.GetAttachedEntity())
1100  return TryReplaceItem(item, storage, slotID, cb);
1101  // we are picking up item from ground into empty slot, simply return result of the insert operation
1102  return TryInsertItemInStorage(item, storage, slotID, cb);
1103  }
1104 
1105  // our target slot is empty and we moving item from another storage
1106  // simply return the result of move operation
1107  if (!m_TargetSlot.GetAttachedEntity())
1108  return TryMoveItemToStorage(item, storage, slotID, cb);
1109 
1110  // if we want to drop originally equipped item
1111  // here sequence would be as follows:
1112  // 1 - drop original item
1113  // 2 - insert item to target storage
1114  // 3 - try move as many items as possible from dropped item back to inventory
1115  // 4 - delete dropped item
1116 
1117  // At first - let's validate if this is even possible
1118  if (!CanSwapItemStorages(item, m_TargetSlot.GetAttachedEntity()))
1119  return false;
1120 
1121  DropAndMoveOperationCallback chainedCallback = new DropAndMoveOperationCallback();
1122  chainedCallback.m_Manager = this;
1123  chainedCallback.m_ItemAfter = itemComp;
1124  chainedCallback.m_ItemBefore = InventoryItemComponent.Cast(m_TargetSlot.GetAttachedEntity().FindComponent(InventoryItemComponent));
1125  chainedCallback.m_TargetSlot = m_TargetSlot;
1126  chainedCallback.m_bDeleteItemIfEmpty = deleteOriginalItemIfEmpty;
1127  chainedCallback.m_bIstakenFromArsenal = isTakenFromArsenal;
1128  chainedCallback.m_FinalCB = cb;
1129 
1130  return TryRemoveItemFromStorage(m_TargetSlot.GetAttachedEntity(), m_TargetSlot.GetStorage(), chainedCallback);
1131  }
1132 
1133  //------------------------------------------------------------------------------------------------
1140  bool TryReplaceItem( BaseInventoryStorageComponent storage, IEntity item, int preferred, SCR_InvCallBack cb )
1141  {
1142  int slotCount = storage.GetSlotsCount();
1143 
1144  for ( int i = 0; i < slotCount; i++ )
1145  {
1146  int j = ( i + preferred ) % slotCount;
1147  if ( CanReplaceItem( item, storage, j ) )
1148  {
1149  if ( TryReplaceItem( item, storage, j, cb ) )
1150  return true;
1151  }
1152  }
1153 
1154  return false;
1155  }
1156 
1157  //------------------------------------------------------------------------------------------------
1161  void EquipItem( EquipedWeaponStorageComponent weaponStorage, IEntity weapon )
1162  {
1163  // There are empty suitable slots at weapon storage
1164  if ( CanInsertItemInStorage( weapon, weaponStorage, -1) )
1165  {
1166  TryInsertItemInStorage( weapon, weaponStorage, -1 );
1167  return;
1168  }
1169 
1170  // Otherwise try replace weapon at suitable slot
1171  BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast( GetOwner().FindComponent(BaseWeaponManagerComponent) );
1172  if (!weaponManager)
1173  return;
1174 
1175  WeaponSlotComponent slot = weaponManager.GetCurrentSlot();
1176  int slotCount = weaponStorage.GetSlotsCount();
1177  int preferred = 0;
1178  if ( slot )
1179  preferred = slot.GetWeaponSlotIndex();
1180 
1181  for ( int i = 0; i < slotCount; i++ )
1182  {
1183  int j = ( i + preferred ) % slotCount;
1184  if ( CanReplaceItem( weapon, weaponStorage, j ) )
1185  {
1186  TryReplaceItem( weapon, weaponStorage, j );
1187  return;
1188  }
1189  }
1190  }
1191 
1192  //------------------------------------------------------------------------------------------------
1200  bool IsResupplyMagazinesAvailable(int resupplyMagazineCount = 4, out EResupplyUnavailableReason resupplyUnavailableReason = EResupplyUnavailableReason.NONE, EMuzzleType muzzleType = -1, InventoryStorageManagerComponent mustBeInStorage = null)
1201  {
1202  BaseWeaponManagerComponent weaponsManager = BaseWeaponManagerComponent.Cast(GetOwner().FindComponent(BaseWeaponManagerComponent));
1203  if (!weaponsManager)
1204  return false;
1205 
1206  array<IEntity> weaponList = {};
1207  weaponsManager.GetWeaponsList(weaponList);
1208 
1209  bool foundValidWeapon = false;
1210  ResourceName magazineOrProjectilePrefab;
1211  IEntity spawnedMagazine;
1212 
1213  BaseWeaponComponent comp;
1214  array<BaseMuzzleComponent> muzzles;
1215  SCR_MuzzleInMagComponent inMagMuzzle;
1216  SCR_ArsenalInventoryStorageManagerComponent arsenalStorage;
1217  foreach (IEntity weapon : weaponList)
1218  {
1219  comp = BaseWeaponComponent.Cast(weapon.FindComponent(BaseWeaponComponent));
1220  if (!comp)
1221  continue;
1222 
1223  string weaponSlotType = comp.GetWeaponSlotType();
1224 
1225  // Only refill primary and secondary weapons
1226  if ((weaponSlotType != "primary" && weaponSlotType != "secondary"))
1227  continue;
1228 
1229  muzzles = {};
1230 
1231  //~ Get base muzzle to only supply magazines
1232  comp.GetMuzzlesList(muzzles);
1233  foreach (BaseMuzzleComponent muzzle : muzzles)
1234  {
1235  if (muzzleType != -1 && muzzle.GetMuzzleType() != muzzleType)
1236  continue;
1237 
1238  inMagMuzzle = SCR_MuzzleInMagComponent.Cast(muzzle);
1239  if (inMagMuzzle && !inMagMuzzle.CanBeReloaded())
1240  continue;
1241 
1242  magazineOrProjectilePrefab = muzzle.GetDefaultMagazineOrProjectileName();
1243  if (SCR_StringHelper.IsEmptyOrWhiteSpace(magazineOrProjectilePrefab))
1244  continue;
1245 
1246  //~ At least one valid weapon was found
1247  foundValidWeapon = true;
1248 
1249  //~ If storage is given check if magazine or projectile is in storage and only allow resupply if it is (Does not care for amount and intended use is with Arsenal)
1250  if (mustBeInStorage)
1251  {
1252  arsenalStorage = SCR_ArsenalInventoryStorageManagerComponent.Cast(mustBeInStorage);
1253  if ((arsenalStorage && !arsenalStorage.IsPrefabInArsenalStorage(magazineOrProjectilePrefab)) || (!arsenalStorage && mustBeInStorage.GetDepositItemCountByResource(magazineOrProjectilePrefab) < 1))
1254  {
1255  if (resupplyUnavailableReason < EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE)
1256  resupplyUnavailableReason = EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE;
1257 
1258  continue;
1259  }
1260  }
1261 
1262  //~ Check if there are already enough magazines
1263  if (resupplyMagazineCount - GetMagazineCountByMuzzle(muzzle) <= 0)
1264  {
1265  if (resupplyUnavailableReason < EResupplyUnavailableReason.ENOUGH_ITEMS)
1266  resupplyUnavailableReason = EResupplyUnavailableReason.ENOUGH_ITEMS;
1267 
1268  continue;
1269  }
1270 
1271  //~ If it can be stored
1272  if (!FindStorageForResourceInsert(magazineOrProjectilePrefab, m_Storage))
1273  {
1274  if (resupplyUnavailableReason < EResupplyUnavailableReason.INVENTORY_FULL)
1275  resupplyUnavailableReason = EResupplyUnavailableReason.INVENTORY_FULL;
1276 
1277  continue;
1278  }
1279 
1280  //~ Passes all the checks
1281  //~ Set reason none just in case as resupply is available
1282  resupplyUnavailableReason = EResupplyUnavailableReason.NONE;
1283 
1284  //~ All checks passed and at least one magazine can be added so function returns true
1285  return true;
1286  }
1287  }
1288 
1289  //~ Did not have any valid weapons so set unavailable reason to no valid weapon
1290  if (!foundValidWeapon)
1291  resupplyUnavailableReason = EResupplyUnavailableReason.NO_VALID_WEAPON;
1292 
1293  return false;
1294  }
1295 
1296  //------------------------------------------------------------------------------------------------
1302  void GetValidResupplyItemsAndCount(out notnull map<ResourceName, int> validResupplyItems, int maxMagazineCount = 4, EMuzzleType muzzleType = -1, InventoryStorageManagerComponent mustBeInStorage = null)
1303  {
1304  validResupplyItems.Clear();
1305 
1306  BaseWeaponManagerComponent weaponsManager = BaseWeaponManagerComponent.Cast(GetOwner().FindComponent(BaseWeaponManagerComponent));
1307  if (!weaponsManager)
1308  return;
1309 
1310  array<IEntity> weaponList = {};
1311  weaponsManager.GetWeaponsList(weaponList);
1312 
1313  BaseWeaponComponent comp;
1314  array<BaseMuzzleComponent> muzzles;
1315  SCR_MuzzleInMagComponent inMagMuzzle;
1316  SCR_ArsenalInventoryStorageManagerComponent arsenalStorage;
1317  foreach (IEntity weapon : weaponList)
1318  {
1319  comp = BaseWeaponComponent.Cast(weapon.FindComponent(BaseWeaponComponent));
1320  string weaponSlotType = comp.GetWeaponSlotType();
1321 
1322  // Only refill primary and secondary weapons
1323  if (!(weaponSlotType == "primary" || weaponSlotType == "secondary"))
1324  continue;
1325 
1326  muzzles = {};
1327 
1328  //~ Get base muzzle to only supply magazines
1329  comp.GetMuzzlesList(muzzles);
1330  foreach (BaseMuzzleComponent muzzle : muzzles)
1331  {
1332  if (muzzleType != -1 && muzzle.GetMuzzleType() != muzzleType)
1333  continue;
1334 
1335  inMagMuzzle = SCR_MuzzleInMagComponent.Cast(muzzle);
1336  if (inMagMuzzle && !inMagMuzzle.CanBeReloaded())
1337  continue;
1338 
1339  ResourceName magazineOrProjectilePrefab = muzzle.GetDefaultMagazineOrProjectileName();
1340  if (SCR_StringHelper.IsEmptyOrWhiteSpace(magazineOrProjectilePrefab))
1341  continue;
1342 
1343  //~ Get current magazine count and see if it needs to be increased
1344  int resupplyCount = maxMagazineCount - GetMagazineCountByMuzzle(muzzle);
1345  if (resupplyCount <= 0)
1346  continue;
1347 
1348  //~ If storage is given check if magazine or projectile is in storage and only allow resupply if it is (Does not care for amount and intended use is with Arsenal)
1349  if (mustBeInStorage)
1350  {
1351  arsenalStorage = SCR_ArsenalInventoryStorageManagerComponent.Cast(mustBeInStorage);
1352  if ((arsenalStorage && !arsenalStorage.IsPrefabInArsenalStorage(magazineOrProjectilePrefab)) || (!arsenalStorage && mustBeInStorage.GetDepositItemCountByResource(magazineOrProjectilePrefab) < 1))
1353  continue;
1354  }
1355 
1356  //~ Add magazine to be resupplied
1357  if (!validResupplyItems.Contains(magazineOrProjectilePrefab))
1358  validResupplyItems.Insert(magazineOrProjectilePrefab, resupplyCount);
1359  //~ Update count till max
1360  else
1361  validResupplyItems[magazineOrProjectilePrefab] = Math.Clamp(validResupplyItems[magazineOrProjectilePrefab] + resupplyCount, 0, maxMagazineCount);
1362  }
1363  }
1364  }
1365 
1366  //------------------------------------------------------------------------------------------------
1369  void ResupplyMagazines(notnull map<ResourceName, int> validResupplyItems)
1370  {
1371  //~ Nothing to resupply
1372  if (validResupplyItems.IsEmpty())
1373  return;
1374 
1375  if (!m_ResupplyMagazineCallback)
1376  m_ResupplyMagazineCallback = new SCR_ResupplyMagazinesCallback(this);
1377 
1378  //~ Resupply each given entry
1379  foreach (ResourceName itemPrefab, int count : validResupplyItems)
1380  {
1381  m_ResupplyMagazineCallback.Insert(itemPrefab, count);
1382  }
1383 
1384  m_ResupplyMagazineCallback.Start();
1385  }
1386 
1387  //------------------------------------------------------------------------------------------------
1392  void ResupplyMagazines(int maxMagazineCount = 4, EMuzzleType muzzleType = -1, InventoryStorageManagerComponent mustBeInStorage = null)
1393  {
1394  //~ Get resupply prefabs
1395  map<ResourceName, int> validResupplyItems = new map<ResourceName, int>();
1396  GetValidResupplyItemsAndCount(validResupplyItems, maxMagazineCount, muzzleType, mustBeInStorage);
1397 
1398  //~ Resupply
1399  ResupplyMagazines(validResupplyItems);
1400  }
1401 
1402  //------------------------------------------------------------------------------------------------
1404  void EndResupplyMagazines()
1405  {
1406  delete m_ResupplyMagazineCallback;
1407  }
1408 
1409  //------------------------------------------------------------------------------------------------
1416  EResupplyUnavailableReason CanResupplyMuzzle(notnull BaseMuzzleComponent muzzle, int maxMagazineCount = -1, InventoryStorageManagerComponent mustBeInStorage = null, out int currentMagazineAmount = -1)
1417  {
1418  //~ Cannot resupply weapons that cannot be ressupplied like the US rocket Launcer
1419  SCR_MuzzleInMagComponent inMagMuzzle = SCR_MuzzleInMagComponent.Cast(muzzle);
1420  if (inMagMuzzle && !inMagMuzzle.CanBeReloaded())
1421  return EResupplyUnavailableReason.NO_VALID_WEAPON;
1422 
1423  //~ Get default magazine to resupply
1424  ResourceName magazineToResupply = muzzle.GetDefaultMagazineOrProjectileName();
1425  if (SCR_StringHelper.IsEmptyOrWhiteSpace(magazineToResupply))
1426  return EResupplyUnavailableReason.NO_VALID_WEAPON;
1427 
1428  //~ Check if it is in arsenal or in the storage
1429  if (mustBeInStorage)
1430  {
1431  SCR_ArsenalInventoryStorageManagerComponent arsenalStorage = SCR_ArsenalInventoryStorageManagerComponent.Cast(mustBeInStorage);
1432  if ((arsenalStorage && !arsenalStorage.IsPrefabInArsenalStorage(magazineToResupply)) || (!arsenalStorage && mustBeInStorage.GetDepositItemCountByResource(magazineToResupply) < 1))
1433  return EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE;
1434  }
1435 
1436  //~ Already has enough magazines
1437  currentMagazineAmount = GetMagazineCountByMuzzle(muzzle);
1438  if (maxMagazineCount > 0 && currentMagazineAmount >= maxMagazineCount)
1439  return EResupplyUnavailableReason.ENOUGH_ITEMS;
1440 
1441  //~ Check if there is space in the inventory
1442  if (!FindStorageForResourceInsert(magazineToResupply, m_Storage))
1443  return EResupplyUnavailableReason.INVENTORY_FULL;
1444 
1445  return EResupplyUnavailableReason.RESUPPLY_VALID;
1446  }
1447 
1448  //------------------------------------------------------------------------------------------------
1455  EResupplyUnavailableReason CanResupplyItem(ResourceName itemToResupply, int maxItemCount = -1, InventoryStorageManagerComponent mustBeInStorage = null, out int currentItemAmount = -1)
1456  {
1457  //~ Check if it is in arsenal or in the storage
1458  if (mustBeInStorage)
1459  {
1460  SCR_ArsenalInventoryStorageManagerComponent arsenalStorage = SCR_ArsenalInventoryStorageManagerComponent.Cast(mustBeInStorage);
1461  if ((arsenalStorage && !arsenalStorage.IsPrefabInArsenalStorage(itemToResupply)) || (!arsenalStorage && mustBeInStorage.GetDepositItemCountByResource(itemToResupply) < 1))
1462  return EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE;
1463  }
1464 
1465  //~ Already has enough of the item in storage
1466  currentItemAmount = GetDepositItemCountByResource(itemToResupply);
1467  if (maxItemCount > 0 && currentItemAmount >= maxItemCount)
1468  return EResupplyUnavailableReason.ENOUGH_ITEMS;
1469 
1470  //~ Check if there is space in the inventory
1471  if (!FindStorageForResourceInsert(itemToResupply, m_Storage))
1472  return EResupplyUnavailableReason.INVENTORY_FULL;
1473 
1474  return EResupplyUnavailableReason.RESUPPLY_VALID;
1475  }
1476 
1477  //------------------------------------------------------------------------------------------------
1481  void MoveItemToVicinity(IEntity pItem, BaseInventoryStorageComponent pStorageTo = null);
1482 
1483  //------------------------------------------------------------------------------------------------
1485  void OpenInventory()
1486  {
1487  if (m_CharacterController && m_CharacterController.GetLifeState() != ECharacterLifeState.ALIVE)
1488  return;
1489 
1490  MenuManager menuManager = GetGame().GetMenuManager();
1491  ChimeraMenuPreset menu = ChimeraMenuPreset.Inventory20Menu;
1492 
1493  MenuBase inventoryMenu = menuManager.FindMenuByPreset(menu);
1494  if (inventoryMenu)
1495  return;
1496 
1497  menuManager.OpenMenu( menu );
1498  m_OnInventoryOpenInvoker.Invoke(true);
1499 
1500  if (!m_CharacterController)
1501  return;
1502 
1503  // Quit ADS
1504  m_CharacterController.SetWeaponADS(false);
1505  m_CharacterController.SetGadgetRaisedModeWanted(false);
1506 
1507  // Pin grenade
1508  if (m_CharacterController.GetInputContext() && m_CharacterController.GetInputContext().GetThrow())
1509  m_CharacterController.SetThrow(false, true);
1510 
1511  // Inspection or lowered weapon stance
1512  m_bWasRaised = m_CharacterController.IsWeaponRaised();
1513  m_CharacterController.SetWeaponRaised(false);
1514  }
1515 
1516  //------------------------------------------------------------------------------------------------
1518  void CloseInventory()
1519  {
1520  MenuManager menuManager = GetGame().GetMenuManager();
1521  if (!menuManager)
1522  return;
1523 
1524  menuManager.CloseMenuByPreset(ChimeraMenuPreset.Inventory20Menu);
1525  }
1526 
1527  //------------------------------------------------------------------------------------------------
1529  IEntity GetStorageToOpen()
1530  {
1531  IEntity result = m_StorageToOpen;
1532  m_StorageToOpen = null;
1533 
1534  return result;
1535  }
1536 
1537  //------------------------------------------------------------------------------------------------
1539  void SetStorageToOpen(IEntity storage)
1540  {
1541  m_StorageToOpen = storage;
1542  }
1543 
1544  //------------------------------------------------------------------------------------------------
1546  void Action_OpenInventory()
1547  {
1548  CompartmentAccessComponent cac = m_CharacterController.GetCharacter().GetCompartmentAccessComponent();
1549  if (cac && cac.IsInCompartment())
1550  {
1551  IEntity owner = cac.GetCompartment().GetOwner();
1552  while (owner)
1553  {
1554  UniversalInventoryStorageComponent comp = UniversalInventoryStorageComponent.Cast(owner.FindComponent(UniversalInventoryStorageComponent));
1555  if (comp)
1556  {
1557  SetStorageToOpen(owner);
1558  break;
1559  }
1560 
1561  owner = owner.GetParent();
1562  }
1563  }
1564 
1565  OpenInventory();
1566  }
1567 
1568  //------------------------------------------------------------------------------------------------
1569  void OnInventoryMenuClosed()
1570  {
1571  m_OnInventoryOpenInvoker.Invoke(false);
1572 
1573  // Revert inspection or lowered weapon stance
1575  m_CharacterController.SetWeaponRaised(m_bWasRaised);
1576  }
1577 
1578  //------------------------------------------------------------------------------------------------
1579  override void OnStorageAdded(BaseInventoryStorageComponent storage)
1580  {
1581  // do nothing
1582  }
1583 
1584 // //------------------------------------------------------------------------------------------------
1585 // //! Even after physics update
1586 // //! \param[in] owner The owner entity
1587 // //! \param[in] frameNumber Time passed since last frame
1588 // override void EOnPostFrame(IEntity owner, float timeSlice)
1589 // {
1590 // m_OnPostFrameInvoker.Invoke(timeSlice);
1591 // }
1592 
1593  //------------------------------------------------------------------------------------------------
1595  void DebugListAllItemsInInventory()
1596  {
1597  array<IEntity> items = {};
1598  GetItems(items);
1599  Print("INV: no item", LogLevel.NORMAL);
1600  InventoryItemComponent pInvComp;
1601  ItemAttributeCollection attribs;
1602  foreach (IEntity item : items)
1603  {
1604  pInvComp = InventoryItemComponent.Cast( item .FindComponent( InventoryItemComponent ) );
1605  if( pInvComp )
1606  {
1607  attribs = pInvComp.GetAttributes();
1608  if( !attribs )
1609  break;
1610 
1611  string sName = attribs.GetUIInfo().GetName();
1612  Print("INV: " + sName, LogLevel.NORMAL);
1613 
1614  }
1615  }
1616  }
1617 
1618  //------------------------------------------------------------------------------------------------
1619  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
1620  protected void RpcAsk_ServerToDeleteEntity(RplId targetRplId)
1621  {
1622  RplComponent rplComp = RplComponent.Cast(Replication.FindItem(targetRplId));
1623  if (!rplComp)
1624  return;
1625 
1626  IEntity entity = rplComp.GetEntity();
1627  if (!entity)
1628  return;
1629 
1630  RplComponent.DeleteRplEntity(entity, false);
1631  }
1632 
1633  //------------------------------------------------------------------------------------------------
1636  void AskServerToDeleteEntity(IEntity ent)
1637  {
1638  RplComponent rplComp = RplComponent.Cast(ent.FindComponent(RplComponent));
1639  if (!rplComp)
1640  return;
1641 
1642  RplId rplId = rplComp.Id();
1643  Rpc(RpcAsk_ServerToDeleteEntity, rplId);
1644  }
1645 
1646  //------------------------------------------------------------------------------------------------
1648  void EnablePostFrame(bool enable)
1649  {
1650  if (enable)
1651  SetEventMask(GetOwner(), EntityEvent.POSTFRAME);
1652  else
1653  ClearEventMask(GetOwner(), EntityEvent.POSTFRAME);
1654  }
1655 
1656  //------------------------------------------------------------------------------------------------
1658  int GetHealthComponentCount()
1659  {
1660  return m_iHealthEquipment;
1661  }
1662 
1663  //------------------------------------------------------------------------------------------------
1665  IEntity GetBandageItem()
1666  {
1667  return FindItem(m_BandagePredicate, EStoragePurpose.PURPOSE_DEPOSIT);
1668  }
1669 
1670  //------------------------------------------------------------------------------------------------
1671  // destructor
1672  void ~SCR_InventoryStorageManagerComponent()
1673  {
1674  m_ERetCode = EInventoryRetCode.RETCODE_DEFAULT_STATE;
1675  }
1676 
1677  //------------------------------------------------------------------------------------------------
1679  bool IsAnimationReady()
1680  {
1682  return m_CharacterController.CanPlayItemGesture() || m_CharacterController.IsPlayingItemGesture();
1683  return true;
1684  }
1685 
1686  //------------------------------------------------------------------------------------------------
1688  bool IsInventoryLocked()
1689  {
1690  return m_bIsInventoryLocked;
1691  }
1692 
1693  //------------------------------------------------------------------------------------------------
1695  void SetInventoryLocked(bool isLocked)
1696  {
1697  m_bIsInventoryLocked = isLocked;
1698  }
1699 
1700  //------------------------------------------------------------------------------------------------
1704  int GetAllItems(inout array<IEntity> items, BaseInventoryStorageComponent storage)
1705  {
1706  if (!storage || !items)
1707  return 0;
1708 
1709  int count = 0;
1710 
1711  if (!ClothNodeStorageComponent.Cast(storage))
1712  count = storage.GetAll(items);
1713 
1714  array<BaseInventoryStorageComponent> itemToReplaceAttachedStorages = {};
1715  storage.GetOwnedStorages(itemToReplaceAttachedStorages, 1, false);
1716  foreach (BaseInventoryStorageComponent attachedStorage : itemToReplaceAttachedStorages)
1717  {
1718  if (ClothNodeStorageComponent.Cast(attachedStorage))
1719  attachedStorage.GetOwnedStorages(itemToReplaceAttachedStorages, 1, false);
1720  else
1721  count += attachedStorage.GetAll(items);
1722  }
1723 
1724  return count;
1725  }
1726 
1727  //------------------------------------------------------------------------------------------------
1732  void GetWeaponPrefabsOfType(notnull array<IEntity> weapons, EWeaponType weaponType, notnull out array<EntityPrefabData> prefabs)
1733  {
1734  BaseWeaponComponent weapon;
1735  EntityPrefabData prefabData;
1736  foreach (IEntity item : weapons)
1737  {
1738  weapon = BaseWeaponComponent.Cast(item.FindComponent(BaseWeaponComponent));
1739  if (weapon.GetWeaponType() != weaponType)
1740  continue;
1741 
1742  // Ignore currently selected items
1743  prefabData = item.GetPrefabData();
1744  if (prefabData && !prefabs.Contains(prefabData))
1745  prefabs.Insert(prefabData);
1746  }
1747  }
1748 
1749  //------------------------------------------------------------------------------------------------
1755  IEntity FindNextWeaponOfType(EWeaponType weaponType, IEntity currentItem = null, bool allowCurrentPrefab = false)
1756  {
1757  array<EntityPrefabData> prefabs = {};
1758 
1759  // Currently selected weapon may be outside of inventory and it has to be considered for sorting
1760  EntityPrefabData currentPrefab;
1761  BaseWeaponComponent currentWeapon;
1762  if (currentItem)
1763  {
1764  currentPrefab = currentItem.GetPrefabData();
1765  currentWeapon = BaseWeaponComponent.Cast(currentItem.FindComponent(BaseWeaponComponent));
1766 
1767  if (currentPrefab && currentWeapon.GetWeaponType() == weaponType)
1768  prefabs.Insert(currentPrefab);
1769  }
1770 
1771  // Collect all the matching prefabs
1772  array<IEntity> items = {};
1773  FindItemsWithComponents(items, {BaseWeaponComponent});
1774  GetWeaponPrefabsOfType(items, weaponType, prefabs);
1775 
1776  // No valid prefabs
1777  if (prefabs.IsEmpty())
1778  return null;
1779 
1780  // TODO: better sorting, perhaps by name
1781  prefabs.Sort();
1782 
1783 // foreach (EntityPrefabData prefab : prefabs)
1784 // {
1785 // Print(prefab.GetPrefabName(), LogLevel.WARNING);
1786 // }
1787 
1788  // Select next prefab
1789  int nextPrefabID = (prefabs.Find(currentPrefab) + 1) % prefabs.Count();
1790  EntityPrefabData nextPrefab = prefabs[nextPrefabID];
1791 
1792  // Return nothing if prefab is unchanged
1793  if (!allowCurrentPrefab && nextPrefab == currentPrefab)
1794  return null;
1795 
1796  // Select the weapon that matches the type to be selected
1797  foreach (IEntity item : items)
1798  {
1799  if (item && item.GetPrefabData() == nextPrefab)
1800  return item;
1801  }
1802 
1803  return null;
1804  }
1805 
1806 #else
1807 
1808  //------------------------------------------------------------------------------------------------
1810  void SetReturnCode( EInventoryRetCode ERetCode ) ;
1811 
1812  //------------------------------------------------------------------------------------------------
1813  void SetReturnCodeDefault() ;
1814 
1815  //------------------------------------------------------------------------------------------------
1817  EInventoryRetCode GetReturnCode()
1818  {
1819  return m_ERetCode;
1820  }
1821 
1822  //------------------------------------------------------------------------------------------------
1824  float GetTotalWeightOfAllStorages();
1825 
1826  //------------------------------------------------------------------------------------------------
1828  void SetLootStorage( IEntity pOwner );
1829 
1830  //------------------------------------------------------------------------------------------------
1833  void InsertItem( IEntity pItem );
1834 
1835  //------------------------------------------------------------------------------------------------
1840  void EquipWeapon( IEntity pOwnerEntity, SCR_InvCallBack cb = null, bool bFromVicinity = true );
1841 
1842  //------------------------------------------------------------------------------------------------
1845  void EquipGadget( IEntity pOwnerEntity );
1846 
1847  //------------------------------------------------------------------------------------------------
1850  void EquipCloth( IEntity pOwnerEntity );
1851 
1852  //------------------------------------------------------------------------------------------------
1857  void EquipAny(BaseInventoryStorageComponent storage, IEntity item, int preferred = 0);
1858 
1859  //------------------------------------------------------------------------------------------------
1863  void EquipItem( EquipedWeaponStorageComponent weaponStorage, IEntity weapon );
1864 
1865  //------------------------------------------------------------------------------------------------
1867  void OpenInventory();
1868 
1869  //------------------------------------------------------------------------------------------------
1871  void Action_OpenInventory();
1872 
1873  //------------------------------------------------------------------------------------------------
1874  override void OnStorageAdded(BaseInventoryStorageComponent storage);
1875 
1876  //------------------------------------------------------------------------------------------------
1879  void EnablePostFrame(bool enable);
1880 
1881  //------------------------------------------------------------------------------------------------
1883  int GetHealthComponentCount();
1884 
1885  //------------------------------------------------------------------------------------------------
1887  IEntity GetBandageItem();
1888 
1889 #endif
1890 
1891  //------------------------------------------------------------------------------------------------
1892  // constructor
1896  void SCR_InventoryStorageManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
1897  {
1898  #ifndef DISABLE_INVENTORY
1899 
1900  //ChimeraCharacter pChimeraChar = ChimeraCharacter.Cast( ent );
1901  //pChimeraChar.s_OnCharacterCreated.Insert( DebugListAllItemsInInventory );
1902 
1903  m_Storage = SCR_CharacterInventoryStorageComponent.Cast(ent.FindComponent(CharacterInventoryStorageComponent));
1905  #endif
1906  }
1907 }
WeaponAttachmentAttributes
Definition: WeaponAttachmentAttributes.c:12
ECharacterHitZoneGroup
ECharacterHitZoneGroup
Definition: SCR_CharacterDamageManagerComponent.c:1
SCR_EConsumableType
SCR_EConsumableType
Type of consumable gadget.
Definition: SCR_ConsumableEffectBase.c:2
SCR_WeaponSwitchingBaseUI
Definition: SCR_WeaponSwitchingBaseUI.c:4
NONE
@ NONE
Gadget anim variable.
Definition: SCR_AIActivitySmokeCoverFeature.c:3
SCR_InvCallBack
Definition: SCR_InventoryMenuUI.c:56
SCR_ConsumableEffectHealthItems
Definition: SCR_ConsumableEffectHealthItems.c:2
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
DELETE
@ DELETE
Definition: EEditorEvent.c:12
ECharacterLifeState
ECharacterLifeState
Definition: ECharacterLifeState.c:12
CanReplaceItem
event bool CanReplaceItem(IEntity nextItem, int slotID)
Implemented logics for can replace to nextItem at slotID,.
Definition: BaseInventoryStorageComponent.c:130
InventoryStorageSlot
Definition: InventoryStorageSlot.c:12
SCR_UISoundEntity
Definition: SCR_UISoundEntity.c:7
ItemAttributeCollection
Definition: ItemAttributeCollection.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
OnItemRemoved
override protected void OnItemRemoved(BaseInventoryStorageComponent storageOwner, IEntity item)
Definition: SCR_ArsenalInventoryStorageManagerComponent.c:95
GetStorages
void GetStorages(out notnull array< SCR_UniversalInventoryStorageComponent > storagesInInventory)
Definition: SCR_CharacterInventoryStorageComponent.c:166
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
ECommonItemType
ECommonItemType
Definition: InventoryConstants.c:30
BaseAttachmentType
Definition: BaseAttachmentType.c:12
SCR_UniversalInventoryStorageComponent
void SCR_UniversalInventoryStorageComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_UniversalInventoryStorageComponent.c:259
InventoryOperationCallback
Definition: InventoryOperationCallback.c:12
SCR_StringHelper
Definition: SCR_StringHelper.c:1
EDamageState
EDamageState
Definition: EDamageState.c:12
OnComplete
protected override void OnComplete()
Definition: SCR_CharacterInventoryStorageComponent.c:34
WeaponSlotComponent
Definition: WeaponSlotComponent.c:12
RETCODE_OK
SCR_InventoryStorageManagerComponentClass RETCODE_OK
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
Start
protected void Start()
Definition: SCR_GameModeCampaign.c:465
SCR_SoundManagerEntity
Definition: SCR_SoundManagerEntity.c:17
m_CharacterController
SCR_CharacterPerceivableComponentClass m_CharacterController
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
OnItemAdded
override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)
Definition: SCR_ArsenalInventoryStorageManagerComponent.c:56
OnFailed
protected override void OnFailed()
Definition: SCR_CharacterInventoryStorageComponent.c:43
ScriptedInventoryOperationCallback
Definition: ScriptedInventoryOperationCallback.c:12
InventoryStorageManagerComponent
Definition: InventoryStorageManagerComponent.c:12
InsertItem
event protected ref BaseInventoryTask InsertItem(IEntity item, int slotID)
Called locally per instance, implement insertion logics here, Manager will provide slotID of -1 in ca...
BaseMagazineWell
Definition: BaseMagazineWell.c:12
ScriptedInventoryStorageManagerComponentClass
Definition: ScriptedInventoryStorageManagerComponent.c:1
ScriptInvokerBool
ScriptInvokerBase< ScriptInvokerBoolMethod > ScriptInvokerBool
Definition: SCR_ScriptInvokerHelper.c:41
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
SCR_ItemOfInterestAttribute
Definition: ItemInterestAttributes.c:1
SCR_InventoryStorageManagerComponentClass
Definition: SCR_InventoryStorageManagerComponent.c:2
EItemGesture
EItemGesture
Definition: EItemGesture.c:12
RETCODE_DEFAULT_STATE
SCR_InventoryVehicleVisibilityAttribute RETCODE_DEFAULT_STATE
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
InventoryItemComponent
Definition: InventoryItemComponent.c:12
EMuzzleType
EMuzzleType
Definition: EMuzzleType.c:12
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3
EStoragePurpose
EStoragePurpose
Definition: EStoragePurpose.c:12
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
EWeaponType
EWeaponType
Definition: EWeaponType.c:12
MOVE
@ MOVE
Definition: SCR_AICombatMoveRequest.c:3
RETCODE_ITEM_TOO_HEAVY
SCR_InventoryStorageManagerComponentClass RETCODE_ITEM_TOO_HEAVY
SetLootStorage
void SetLootStorage(IEntity pOwner)
Definition: SCR_CharacterInventoryStorageComponent.c:200
RETCODE_ITEM_TOO_BIG
SCR_InventoryStorageManagerComponentClass RETCODE_ITEM_TOO_BIG
BaseMuzzleComponent
Definition: BaseMuzzleComponent.c:12
DamageManagerComponent
Definition: DamageManagerComponent.c:12
SCR_ArsenalComponent
Definition: SCR_ArsenalComponent.c:9
m_Storage
BaseInventoryStorageComponent m_Storage
Definition: SCR_TourniquetStorageComponent.c:10
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180