11 RETCODE_DEFAULT_STATE = 0xFFFF
22enum EResupplyUnavailableReason
28 NOT_IN_GIVEN_STORAGE = 30,
34 RESUPPLY_VALID = 99999,
43 void SCR_HoldableItemPredicate()
45 QueryAttributeTypes.Insert(SCR_ItemOfInterestAttribute);
49 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
51 SCR_ItemOfInterestAttribute optionalAttribute = SCR_ItemOfInterestAttribute.Cast(queriedAttributes[0]);
52 return optionalAttribute.GetInterestType() == wanted;
60 void SCR_BandagePredicate()
62 QueryComponentTypes.Insert(SCR_ConsumableItemComponent);
66 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
68 return (SCR_ConsumableItemComponent.Cast(queriedComponents[0])).GetConsumableType() ==
SCR_EConsumableType.BANDAGE;
79 void SCR_ApplicableMedicalItemPredicate()
81 QueryComponentTypes.Insert(SCR_ConsumableItemComponent);
85 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
97 SCR_ConsumableItemComponent medicalItem = SCR_ConsumableItemComponent.Cast(item.
FindComponent(SCR_ConsumableItemComponent));
98 SCR_ConsumableEffectHealthItems effect = SCR_ConsumableEffectHealthItems.Cast(medicalItem.GetConsumableEffect());
108 int m_iItemType = -1;
116 void SCR_ItemTypeSearchPredicate(
typename type,
int wantedItemType,
IEntity originalItem)
118 QueryComponentTypes.Insert(
type);
119 m_iItemType = wantedItemType;
123 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
125 return (item != m_iOriginalItem) && (SCR_CharacterInventoryStorageComponent.GetItemType(item) == m_iItemType);
141 m_OriginalItem = originalItem;
145 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
147 InventoryItemComponent iic = InventoryItemComponent.Cast(item.
FindComponent(InventoryItemComponent));
148 if (!iic || !iic.GetAttributes())
151 return (item != m_OriginalItem) && (iic.GetAttributes().GetCommonType() ==
m_eItemType);
158 typename attachmentType;
162 void SCR_CompatibleAttachmentPredicate()
164 QueryComponentTypes.Insert(InventoryItemComponent);
168 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
170 InventoryItemComponent itemComp = InventoryItemComponent.Cast(queriedComponents[0]);
175 ItemAttributeCollection itemAttributes = itemComp.GetAttributes();
179 WeaponAttachmentAttributes itemAttribute = WeaponAttachmentAttributes.Cast(itemAttributes.FindAttribute(WeaponAttachmentAttributes));
183 BaseAttachmentType itemAttachmentType = itemAttribute.GetAttachmentType();
184 if (!itemAttachmentType)
187 typename itemAttachmentTypename = itemAttachmentType.Type();
188 if (!itemAttachmentTypename)
191 return itemAttachmentTypename.IsInherited(attachmentType);
199 void SCR_SalinePredicate()
201 QueryComponentTypes.Insert(SCR_ConsumableItemComponent);
205 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
207 if (storage.Type().IsInherited(EquipmentStorageComponent))
217 typename magWellType;
221 void SCR_MagazinePredicate()
223 QueryComponentTypes.Insert(BaseMagazineComponent);
227 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
229 BaseMagazineComponent iMag = BaseMagazineComponent.Cast(queriedComponents[0]);
233 BaseMagazineWell iMagWell = iMag.GetMagazineWell();
237 return (iMagWell.IsInherited(magWellType));
247 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
250 return pd.GetPrefabName() == this.prefabName;
257 EntityPrefabData prefabData;
260 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
270 BaseContainer m_PrefabContainer;
276 void SCR_ResourceNamePredicate(ResourceName rn =
string.Empty,
IEntity excludedItem = null)
278 m_ExcludedItem = excludedItem;
279 Resource resource = Resource.Load(rn);
280 if (resource.IsValid())
281 m_PrefabContainer = resource.GetResource().ToBaseContainer();
285 override protected bool IsMatch(BaseInventoryStorageComponent storage,
IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
287 return item != m_ExcludedItem && item.
GetPrefabData().GetPrefab() == m_PrefabContainer;
293 InventoryItemComponent m_ItemBefore;
294 InventoryItemComponent m_ItemAfter;
295 InventoryStorageSlot m_TargetSlot;
296 SCR_InventoryStorageManagerComponent m_Manager;
297 SCR_InvCallBack m_FinalCB;
298 bool m_bIstakenFromArsenal;
299 ref array<IEntity> m_aItemsToMove = {};
300 ECallbackState m_ECurrentState = 0;
305 switch (m_ECurrentState)
307 case ECallbackState.DROP:
313 case ECallbackState.INSERT:
319 case ECallbackState.MOVE:
325 case ECallbackState.FINAL:
334 protected void OnDropComplete()
337 m_Manager.TryMoveItemToStorage(m_ItemAfter.GetOwner(), m_TargetSlot.GetStorage(), m_TargetSlot.GetID(),
this);
341 protected void OnInsertComplete()
343 if (!m_bIstakenFromArsenal)
345 m_ECurrentState = ECallbackState.FINAL;
357 protected void OnMoveComplete()
372 m_ECurrentState = ECallbackState.FINAL;
378 protected void OnFinalState()
381 m_FinalCB.InternalComplete();
387 protected SCR_InventoryStorageManagerComponent m_Manager;
388 protected ref map<ResourceName, int> m_MagazinesToSpawn =
new map<ResourceName, int>();
389 protected BaseInventoryStorageComponent m_LastTargetStorage;
395 void Insert(ResourceName prefab,
int count)
398 m_MagazinesToSpawn.Find(prefab, currentCount);
399 m_MagazinesToSpawn.Insert(prefab, currentCount + count);
415 if (m_LastTargetStorage)
417 SCR_HandSlotStorageComponent handSlotStorage = SCR_HandSlotStorageComponent.Cast(m_LastTargetStorage);
419 handSlotStorage.SkipAnimation_S();
422 if (!m_MagazinesToSpawn.IsEmpty())
425 ResourceName prefab = m_MagazinesToSpawn.GetKey(0);
426 int count = m_MagazinesToSpawn.GetElement(0);
430 m_MagazinesToSpawn.Remove(prefab);
432 m_MagazinesToSpawn.Set(prefab, count);
434 m_LastTargetStorage = m_Manager.FindStorageForResource(prefab);
435 m_Manager.TrySpawnPrefabToStorage(prefab, m_LastTargetStorage, cb:
this);
448 GetGame().GetCallqueue().CallLater(m_Manager.EndResupplyMagazines, 1,
false);
454 void SCR_ResupplyMagazinesCallback(SCR_InventoryStorageManagerComponent manager)
460class SCR_InventoryStorageManagerComponent : ScriptedInventoryStorageManagerComponent
462 protected ref array<ref SCR_ItemInsertionCallback> m_aQueuedInsertionCallbacks;
464 private SCR_CharacterInventoryStorageComponent
m_Storage;
466 private ref SCR_BandagePredicate m_BandagePredicate =
new SCR_BandagePredicate();
467 protected EInventoryRetCode m_ERetCode;
468 protected int m_iHealthEquipment = 0;
469 protected bool m_bIsInventoryLocked =
false;
470 protected ref SCR_WeaponSwitchingBaseUI m_pWeaponSwitchingUI;
471 private bool m_bWasRaised;
472 private IEntity m_StorageToOpen;
473 protected ref SCR_ResupplyMagazinesCallback m_ResupplyMagazineCallback;
474 protected bool m_bInventoryAccessAllowed =
true;
480 protected const int ITEM_INSERTION_CALLBACK_CLEANUP_TIME = 1100;
486 [
Obsolete(
"Use GetItems or a custom predicate with Find instead.")]
487 int GetAllRootItems(out notnull array<IEntity> rootItems)
490 array<BaseInventoryStorageComponent> storages = {};
496 array<IEntity> items = {};
497 foreach (BaseInventoryStorageComponent storage : storages)
500 if (ClothNodeStorageComponent.Cast(storage))
505 array<BaseInventoryStorageComponent> clothStorages = {};
506 storage.GetOwnedStorages(clothStorages, 1,
false);
508 foreach (BaseInventoryStorageComponent clothStorage : clothStorages)
513 clothStorage.GetAll(items);
514 rootItems.Copy(items);
521 storage.GetAll(items);
522 rootItems.Copy(items);
526 return rootItems.Count();
531 override protected void OnItemAdded(BaseInventoryStorageComponent storageOwner,
IEntity item)
533 super.OnItemAdded(storageOwner, item);
535 SCR_ConsumableItemComponent consumable = SCR_ConsumableItemComponent.Cast(item.
FindComponent(SCR_ConsumableItemComponent));
537 m_iHealthEquipment++;
539 if (storageOwner ==
m_Storage.GetWeaponStorage())
540 ExecuteItemInsertionCallback(item, storageOwner,
true);
547 super.OnItemRemoved(storageOwner, item);
549 SCR_ConsumableItemComponent consumable = SCR_ConsumableItemComponent.Cast(item.
FindComponent(SCR_ConsumableItemComponent));
551 m_iHealthEquipment--;
555 override protected bool ShouldForbidRemoveByInstigator(InventoryStorageManagerComponent instigatorManager, BaseInventoryStorageComponent fromStorage,
IEntity item)
558 SCR_ConsumableItemComponent consumableItemComp = SCR_ConsumableItemComponent.Cast(item.
FindComponent(SCR_ConsumableItemComponent));
559 if (consumableItemComp)
572 void PlayItemSound(
IEntity entity,
string soundEvent)
577 RplComponent rplComp = RplComponent.Cast(entity.
FindComponent(RplComponent));
580 Rpc(RpcAsk_PlaySound, rplComp.Id(), soundEvent);
584 SoundComponent soundComp = SoundComponent.Cast(entity.
FindComponent(SoundComponent));
587 soundComp.SoundEvent(soundEvent);
591 SCR_SoundManagerModule.CreateAndPlayAudioSource(entity, soundEvent);
601 void RpcAsk_PlaySound(
RplId targetRplId,
string soundAction)
603 Rpc(RpcDo_PlaySound, targetRplId, soundAction);
604 RpcDo_PlaySound(targetRplId, soundAction);
612 void RpcDo_PlaySound(
RplId targetRplId,
string soundAction)
614 RplComponent rplComp = RplComponent.Cast(Replication.FindItem(targetRplId));
618 IEntity entity = rplComp.GetEntity();
622 SoundComponent soundComp = SoundComponent.Cast(entity.
FindComponent(SoundComponent));
625 soundComp.SoundEvent(soundAction);
629 SCR_SoundManagerModule.CreateAndPlayAudioSource(entity, soundAction);
633#ifndef DISABLE_INVENTORY
637 SCR_CharacterInventoryStorageComponent GetCharacterStorage()
649 bool CanInsertItemInActualStorage(
IEntity item, BaseInventoryStorageComponent storage,
int slotID = -1)
651 if (!IsAnimationReady() || IsInventoryLocked())
654 array<BaseInventoryStorageComponent> pStorages = {};
655 storage.GetOwnedStorages( pStorages, 1,
false );
656 pStorages.Insert( storage );
658 foreach ( BaseInventoryStorageComponent pStorage : pStorages )
660 bool bCanInsert = CanInsertItemInStorage( item, pStorage, -1 );
661 bool bCanMove = CanMoveItemToStorage( item, pStorage, -1 );
662 if ( bCanInsert || bCanMove )
668 BaseInventoryStorageComponent FindActualStorageForItemResource(ResourceName itemResource, BaseInventoryStorageComponent storage,
int slotID = -1)
670 array<BaseInventoryStorageComponent> storages = {};
671 storage.GetOwnedStorages(storages, 1,
false);
672 storages.Insert(storage);
674 foreach (BaseInventoryStorageComponent actualStorage : storages)
676 if (CanInsertResourceInStorage(itemResource, actualStorage, slotID))
677 return actualStorage;
687 void SetReturnCode( EInventoryRetCode ERetCode )
689 m_ERetCode &= ~ERetCode;
695 void SetReturnCodeDefault()
697 m_ERetCode = EInventoryRetCode.RETCODE_DEFAULT_STATE;
702 EInventoryRetCode GetReturnCode()
709 float GetTotalWeightOfAllStorages()
711 array<BaseInventoryStorageComponent> storages = {};
712 float fTotalWeight = 0.0;
716 storages.Insert(
m_Storage.GetWeaponStorage());
719 foreach (BaseInventoryStorageComponent storage : storages)
721 fTotalWeight += storage.GetTotalWeight();
729 void SetLootStorage(
IEntity pOwner )
741 void InsertItem(
IEntity pItem, BaseInventoryStorageComponent pStorageTo = null, BaseInventoryStorageComponent pStorageFrom = null, SCR_InvCallBack cb = null )
743 if (!pItem || !IsAnimationReady() || IsInventoryLocked())
746 SetInventoryLocked(
true);
748 bool canInsert =
true;
751 string soundEvent = SCR_SoundEvent.SOUND_EQUIP;
753 if ( !TryInsertItem( pItem,
EStoragePurpose.PURPOSE_WEAPON_PROXY, cb ) )
755 if ( !TryInsertItem( pItem,
EStoragePurpose.PURPOSE_EQUIPMENT_ATTACHMENT, cb ) )
759 if ( !TryMoveItemToStorage( pItem, FindStorageForItem( pItem,
EStoragePurpose.PURPOSE_ANY ), -1, cb ) )
760 canInsert = TryMoveItemToStorage(pItem,
m_Storage, -1, cb);
762 soundEvent = SCR_SoundEvent.SOUND_PICK_UP;
764 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_HOTKEY_CONFIRM);
767 soundEvent = SCR_SoundEvent.SOUND_PICK_UP;
772 PlayItemSound(pItem, soundEvent);
778 canInsert = TryReplaceItem( pStorageTo, pItem, 0, cb );
781 SetInventoryLocked(
false);
787 BaseInventoryStorageComponent validStorage = FindStorageForInsert(pItem, pStorageTo,
EStoragePurpose.PURPOSE_EQUIPMENT_ATTACHMENT);
790 validStorage = FindStorageForInsert(pItem, pStorageTo,
EStoragePurpose.PURPOSE_ANY);
794 pStorageTo = validStorage;
801 if (universalStorage)
803 array<BaseInventoryStorageComponent> linkedStorages = {};
804 universalStorage.GetLinkedStorages(linkedStorages);
806 foreach(BaseInventoryStorageComponent linkedStorage : linkedStorages)
809 if (FindStorageForInsert(pItem, linkedStorage,
EStoragePurpose.PURPOSE_ANY))
811 pStorageTo = linkedStorage;
819 canInsert = TryInsertItemInStorage( pItem, pStorageTo, -1, cb );
821 canInsert = TryMoveItemToStorage( pItem, pStorageTo, -1, cb );
825 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_DROP_ERROR);
827 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_DIFR_DROP);
832 SetInventoryLocked(
false);
841 bool TryRemoveItemFromInventory(
IEntity pItem, BaseInventoryStorageComponent storage = null, InventoryOperationCallback cb = null)
843 if (!CanMoveItem(pItem))
848 InventoryItemComponent itemComp = InventoryItemComponent.Cast(pItem.
FindComponent(InventoryItemComponent));
852 InventoryStorageSlot parentSlot = itemComp.GetParentSlot();
854 storage = parentSlot.GetStorage();
857 SetInventoryLocked(
true);
858 bool result = TryRemoveItemFromStorage(pItem, storage, cb);
859 SetInventoryLocked(
false);
870 if (!item || item.
IsDeleted() || !IsAnimationReady() || IsInventoryLocked())
902 bool TrySwapItems(
IEntity pOwnerEntity, BaseInventoryStorageComponent pStorageTo, SCR_InvCallBack cb = null )
907 InventoryStorageSlot slot = pStorageTo.FindSuitableSlotForItem( pOwnerEntity );
911 IEntity replacedEntity = slot.GetAttachedEntity();
914 BaseInventoryStorageComponent weaponStorage =
m_Storage.GetWeaponStorage();
920 if (!cb.m_pStorageToDrop)
921 cb.m_pStorageToDrop = pStorageTo;
925 AddItemInsertionCallback(pOwnerEntity, cb, pStorageTo);
932 ExecuteItemInsertionCallback(pOwnerEntity, pStorageTo,
false);
937 if (!TrySwapItemStorages(pOwnerEntity, slot.GetAttachedEntity(), cb))
939 CharacterHandWeaponSlotComponent handWeaponSlot = CharacterHandWeaponSlotComponent.Cast(slot.GetParentContainer());
943 if (TryRemoveItemFromInventory(slot.GetAttachedEntity()))
957 return TryMoveItemToStorage(pOwnerEntity, pStorageTo, slot.GetID(), cb);
968 protected void AddItemInsertionCallback(notnull
IEntity item, notnull SCR_InvCallBack cb, notnull BaseInventoryStorageComponent storage)
970 ChimeraWorld world = ChimeraWorld.CastFrom(
GetGame().GetWorld());
974 TimeAndWeatherManagerEntity timeAndWeatherManager = world.GetTimeAndWeatherManager();
975 if (!timeAndWeatherManager)
978 if (!m_aQueuedInsertionCallbacks)
979 m_aQueuedInsertionCallbacks = {};
981 m_aQueuedInsertionCallbacks.Insert(
new SCR_ItemInsertionCallback(item, cb, storage, timeAndWeatherManager.GetEngineTime() + 1));
983 GetGame().GetCallqueue().CallLater(CleanupCallbackQueue, ITEM_INSERTION_CALLBACK_CLEANUP_TIME);
991 protected void ExecuteItemInsertionCallback(notnull
IEntity item, notnull BaseInventoryStorageComponent storage,
bool result)
993 if (!m_aQueuedInsertionCallbacks || m_aQueuedInsertionCallbacks.IsEmpty())
996 foreach (SCR_ItemInsertionCallback entry : m_aQueuedInsertionCallbacks)
1001 if (entry.m_Item != item || entry.m_TargetStorage != storage)
1005 if (!entry.m_Callback || entry.m_Callback.m_pStorageToDrop != storage || entry.m_Callback.m_pItem != item)
1009 entry.m_Callback.InternalComplete();
1011 entry.m_Callback.InternalFailed();
1013 entry.m_Callback = null;
1014 entry.m_fExpireTime = 0;
1021 protected void CleanupCallbackQueue()
1023 if (!m_aQueuedInsertionCallbacks)
1026 ChimeraWorld world = ChimeraWorld.CastFrom(
GetGame().GetWorld());
1030 TimeAndWeatherManagerEntity timeAndWeatherManager = world.GetTimeAndWeatherManager();
1031 if (!timeAndWeatherManager)
1034 const array<int> garbageCollection = {};
1035 float currentTimeInSec = timeAndWeatherManager.GetEngineTime();
1036 foreach (
int i, SCR_ItemInsertionCallback entry : m_aQueuedInsertionCallbacks)
1040 garbageCollection.InsertAt(i, 0);
1044 if (entry.m_fExpireTime > currentTimeInSec)
1048 if (entry.m_Callback && entry.m_Callback.m_pStorageToDrop == entry.m_TargetStorage && entry.m_Callback.m_pItem == entry.m_Item)
1049 entry.m_Callback.InternalFailed();
1051 garbageCollection.InsertAt(i, 0);
1054 foreach (
int garbageId : garbageCollection)
1056 m_aQueuedInsertionCallbacks.Remove(garbageId);
1059 if (m_aQueuedInsertionCallbacks.IsEmpty())
1061 GetGame().GetCallqueue().Remove(CleanupCallbackQueue);
1062 m_aQueuedInsertionCallbacks = null;
1071 bool EquipWeapon(
IEntity pOwnerEntity, SCR_InvCallBack cb = null,
bool bFromVicinity =
true )
1073 if ( !bFromVicinity )
1075 bool result = TrySwapItems(pOwnerEntity,
m_Storage.GetWeaponStorage(), cb);
1077 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_DIFR_DROP);
1079 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_DROP_ERROR);
1088 BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(user.
FindComponent(BaseWeaponManagerComponent));
1092 WeaponSlotComponent slot = weaponManager.GetCurrentSlot();
1095 preferred = slot.GetWeaponSlotIndex();
1097 bool result = EquipAny(
m_Storage.GetWeaponStorage(), pOwnerEntity, preferred, cb);
1099 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_DROP_ERROR);
1101 if (cb && cb.m_pStorageFrom != cb.m_pStorageTo)
1102 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_DIFR_DROP);
1104 SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_SAME_DROP);
1107 PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
1116 void EquipWeaponAttachment(
IEntity pOwnerEntity,
IEntity pUserEntity, SCR_InvCallBack cb = null )
1118 BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(pUserEntity.
FindComponent(BaseWeaponManagerComponent));
1122 WeaponSlotComponent slot = weaponManager.GetCurrentSlot();
1126 IEntity weaponEntity = slot.GetWeaponEntity();
1130 BaseInventoryStorageComponent storage = BaseInventoryStorageComponent.Cast(weaponEntity.
FindComponent(BaseInventoryStorageComponent));
1134 EquipAny(storage, pOwnerEntity, -1, cb );
1137 PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
1144 void EquipGadget(
IEntity pOwnerEntity, SCR_InvCallBack cb = null )
1147 BaseInventoryStorageComponent storageComp = FindStorageForItem(pOwnerEntity,
EStoragePurpose.PURPOSE_EQUIPMENT_ATTACHMENT);
1150 EquipAny( storageComp, pOwnerEntity, -1, cb );
1153 PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
1160 void EquipCloth(
IEntity pOwnerEntity )
1166 PlayItemSound(pOwnerEntity, SCR_SoundEvent.SOUND_EQUIP);
1176 bool EquipAny(BaseInventoryStorageComponent storage,
IEntity item,
int preferred = -1, SCR_InvCallBack cb = null)
1178 if (!storage || !item)
1180 InventoryItemComponent itemComp = InventoryItemComponent.Cast(item.
FindComponent(InventoryItemComponent));
1184 InventoryStorageSlot m_TargetSlot = storage.FindSuitableSlotForItem(item);
1189 if (preferred > 0 && preferred < storage.GetSlotsCount())
1190 m_TargetSlot = storage.GetSlot(preferred);
1192 preferred = m_TargetSlot.GetID();
1194 InventoryStorageSlot sourceSlot = itemComp.GetParentSlot();
1196 if (!sourceSlot || !sourceSlot.GetStorage())
1200 if (m_TargetSlot.GetAttachedEntity())
1201 return TryReplaceItem(item, storage, preferred, cb);
1204 return TryInsertItemInStorage(item, storage, preferred, cb);
1209 if (!m_TargetSlot.GetAttachedEntity())
1210 return TryMoveItemToStorage(item, storage, preferred, cb);
1212 BaseInventoryStorageComponent sourceStorage = sourceSlot.GetStorage();
1213 bool isTakenFromArsenal = sourceStorage.GetOwner().FindComponent(SCR_ArsenalComponent);
1214 bool isTakenFromBody =
false;
1216 ChimeraCharacter lootedBodyCharacter = ChimeraCharacter.Cast(sourceStorage.GetOwner());
1217 DamageManagerComponent lootedBodyDamageManager;
1219 if (lootedBodyCharacter)
1220 lootedBodyDamageManager = lootedBodyCharacter.GetDamageManager();
1222 if (lootedBodyDamageManager)
1223 isTakenFromBody = lootedBodyDamageManager.GetState() ==
EDamageState.DESTROYED;
1225 bool performDropOfOriginalItem = isTakenFromBody || isTakenFromArsenal || sourceStorage.GetOwner().FindComponent(SCR_CampaignArmoryStorageComponent) ;
1228 if (performDropOfOriginalItem)
1238 if (!CanSwapItemStorages(item, m_TargetSlot.GetAttachedEntity()))
1241 DropAndMoveOperationCallback chainedCallback =
new DropAndMoveOperationCallback();
1242 chainedCallback.m_Manager =
this;
1243 chainedCallback.m_ItemAfter = itemComp;
1244 chainedCallback.m_ItemBefore = InventoryItemComponent.Cast(m_TargetSlot.GetAttachedEntity().FindComponent(InventoryItemComponent));
1245 chainedCallback.m_TargetSlot = m_TargetSlot;
1246 chainedCallback.m_FinalCB = cb;
1247 chainedCallback.m_bIstakenFromArsenal = isTakenFromArsenal;
1249 return TryRemoveItemFromStorage(m_TargetSlot.GetAttachedEntity(), m_TargetSlot.GetStorage(), chainedCallback);
1253 return TrySwapItemStorages(item, m_TargetSlot.GetAttachedEntity(), cb);
1264 bool TryAssigningNextItemToQuickSlot(notnull
IEntity currentItem,
int quickSlotId = -1,
bool mustBeSamePrefab =
true, out SCR_InvEquipAnyItemCB equipCallback = null,
bool equipNewItem =
false)
1266 if (quickSlotId < 0)
1268 quickSlotId =
m_Storage.GetEntityIndexInQuickslots(currentItem);
1269 if (quickSlotId < 0)
1273 SCR_ResourceNamePredicate specificItemSearch =
new SCR_ResourceNamePredicate(excludedItem: currentItem);
1274 specificItemSearch.m_PrefabContainer = currentItem.GetPrefabData().GetPrefab();
1275 array<IEntity> foundItems = {};
1276 if (FindItems(foundItems, specificItemSearch) <= 0)
1278 if (mustBeSamePrefab)
1282 InventoryItemComponent iic = InventoryItemComponent.Cast(currentItem.FindComponent(InventoryItemComponent));
1286 ItemAttributeCollection attributes = iic.GetAttributes();
1294 SCR_CommonItemTypeSearchPredicate itemTypeSearch =
new SCR_CommonItemTypeSearchPredicate(itemType, currentItem);
1295 if (FindItems(foundItems, itemTypeSearch) <= 0)
1299 IEntity selectedItem = foundItems[0];
1302 equipCallback.m_pItem = selectedItem;
1303 equipCallback.m_pStorageToPickUp =
m_Storage;
1304 equipCallback.m_iSlotToFocus = quickSlotId;
1305 equipCallback.m_bShouldEquip = equipNewItem;
1309 m_Storage.RemoveItemFromQuickSlotAtIndex(quickSlotId);
1310 m_Storage.StoreItemToQuickSlot(selectedItem, quickSlotId);
1311 SCR_WeaponSwitchingBaseUI.HighlightQuickSlot(quickSlotId);
1327 bool TryReplaceAndDropItemAtSlot(BaseInventoryStorageComponent storage,
IEntity item,
int slotID, SCR_InvCallBack cb = null,
bool isTakenFromArsenal =
false)
1329 if (!storage || !item)
1331 InventoryItemComponent itemComp = InventoryItemComponent.Cast(item.
FindComponent(InventoryItemComponent));
1335 InventoryStorageSlot m_TargetSlot = storage.GetSlot(slotID);
1340 InventoryStorageSlot sourceSlot = itemComp.GetParentSlot();
1342 if (!sourceSlot || !sourceSlot.GetStorage())
1346 if (m_TargetSlot.GetAttachedEntity())
1347 return TryReplaceItem(item, storage, slotID, cb);
1349 return TryInsertItemInStorage(item, storage, slotID, cb);
1354 if (!m_TargetSlot.GetAttachedEntity())
1355 return TryMoveItemToStorage(item, storage, slotID, cb);
1365 if (!CanSwapItemStorages(item, m_TargetSlot.GetAttachedEntity()))
1368 DropAndMoveOperationCallback chainedCallback =
new DropAndMoveOperationCallback();
1369 chainedCallback.m_Manager =
this;
1370 chainedCallback.m_ItemAfter = itemComp;
1371 chainedCallback.m_ItemBefore = InventoryItemComponent.Cast(m_TargetSlot.GetAttachedEntity().FindComponent(InventoryItemComponent));
1372 chainedCallback.m_TargetSlot = m_TargetSlot;
1373 chainedCallback.m_bIstakenFromArsenal = isTakenFromArsenal;
1374 chainedCallback.m_FinalCB = cb;
1376 return TryRemoveItemFromStorage(m_TargetSlot.GetAttachedEntity(), m_TargetSlot.GetStorage(), chainedCallback);
1386 bool TryReplaceItem( BaseInventoryStorageComponent storage,
IEntity item,
int preferred, SCR_InvCallBack cb )
1388 int slotCount = storage.GetSlotsCount();
1390 for (
int i = 0; i < slotCount; i++ )
1392 int j = ( i + preferred ) % slotCount;
1395 if ( TryReplaceItem( item, storage, j, cb ) )
1407 void EquipItem( EquipedWeaponStorageComponent weaponStorage,
IEntity weapon )
1410 if ( CanInsertItemInStorage( weapon, weaponStorage, -1) )
1412 TryInsertItemInStorage( weapon, weaponStorage, -1 );
1417 BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(
GetOwner().FindComponent(BaseWeaponManagerComponent) );
1421 WeaponSlotComponent slot = weaponManager.GetCurrentSlot();
1422 int slotCount = weaponStorage.GetSlotsCount();
1425 preferred = slot.GetWeaponSlotIndex();
1427 for (
int i = 0; i < slotCount; i++ )
1429 int j = ( i + preferred ) % slotCount;
1432 TryReplaceItem( weapon, weaponStorage, j );
1446 bool IsResupplyMagazinesAvailable(
int resupplyMagazineCount = 4, out EResupplyUnavailableReason resupplyUnavailableReason = EResupplyUnavailableReason.NONE,
EMuzzleType muzzleType = -1, InventoryStorageManagerComponent mustBeInStorage = null)
1448 BaseWeaponManagerComponent weaponsManager = BaseWeaponManagerComponent.Cast(
GetOwner().FindComponent(BaseWeaponManagerComponent));
1449 if (!weaponsManager)
1452 array<IEntity> weaponList = {};
1453 weaponsManager.GetWeaponsList(weaponList);
1455 bool foundValidWeapon =
false;
1456 ResourceName magazineOrProjectilePrefab;
1459 BaseWeaponComponent comp;
1460 array<BaseMuzzleComponent> muzzles;
1461 SCR_MuzzleInMagComponent inMagMuzzle;
1462 SCR_ArsenalInventoryStorageManagerComponent arsenalStorage;
1463 foreach (
IEntity weapon : weaponList)
1465 comp = BaseWeaponComponent.Cast(weapon.
FindComponent(BaseWeaponComponent));
1469 string weaponSlotType = comp.GetWeaponSlotType();
1472 if ((weaponSlotType !=
"primary" && weaponSlotType !=
"secondary"))
1478 comp.GetMuzzlesList(muzzles);
1479 foreach (BaseMuzzleComponent muzzle : muzzles)
1481 if (muzzleType != -1 && muzzle.GetMuzzleType() != muzzleType)
1484 inMagMuzzle = SCR_MuzzleInMagComponent.Cast(muzzle);
1485 if (inMagMuzzle && !inMagMuzzle.CanBeReloaded())
1488 magazineOrProjectilePrefab = muzzle.GetDefaultMagazineOrProjectileName();
1489 if (SCR_StringHelper.IsEmptyOrWhiteSpace(magazineOrProjectilePrefab))
1493 foundValidWeapon =
true;
1496 if (mustBeInStorage)
1498 arsenalStorage = SCR_ArsenalInventoryStorageManagerComponent.Cast(mustBeInStorage);
1499 if ((arsenalStorage && !arsenalStorage.IsPrefabInArsenalStorage(magazineOrProjectilePrefab)) || (!arsenalStorage && mustBeInStorage.GetDepositItemCountByResource(
GetOwner(), magazineOrProjectilePrefab) < 1))
1501 if (resupplyUnavailableReason < EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE)
1502 resupplyUnavailableReason = EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE;
1509 if (resupplyMagazineCount - GetMagazineCountByMuzzle(null,muzzle) <= 0)
1511 if (resupplyUnavailableReason < EResupplyUnavailableReason.ENOUGH_ITEMS)
1512 resupplyUnavailableReason = EResupplyUnavailableReason.ENOUGH_ITEMS;
1518 if (!FindStorageForResourceInsert(magazineOrProjectilePrefab,
m_Storage))
1520 if (resupplyUnavailableReason < EResupplyUnavailableReason.INVENTORY_FULL)
1521 resupplyUnavailableReason = EResupplyUnavailableReason.INVENTORY_FULL;
1528 resupplyUnavailableReason = EResupplyUnavailableReason.NONE;
1536 if (!foundValidWeapon)
1537 resupplyUnavailableReason = EResupplyUnavailableReason.NO_VALID_WEAPON;
1548 void GetValidResupplyItemsAndCount(out notnull map<ResourceName, int> validResupplyItems,
int maxMagazineCount = 4,
EMuzzleType muzzleType = -1, InventoryStorageManagerComponent mustBeInStorage = null)
1550 validResupplyItems.Clear();
1552 BaseWeaponManagerComponent weaponsManager = BaseWeaponManagerComponent.Cast(
GetOwner().FindComponent(BaseWeaponManagerComponent));
1553 if (!weaponsManager)
1556 array<IEntity> weaponList = {};
1557 weaponsManager.GetWeaponsList(weaponList);
1559 BaseWeaponComponent comp;
1560 array<BaseMuzzleComponent> muzzles;
1561 SCR_MuzzleInMagComponent inMagMuzzle;
1562 SCR_ArsenalInventoryStorageManagerComponent arsenalStorage;
1563 foreach (
IEntity weapon : weaponList)
1565 comp = BaseWeaponComponent.Cast(weapon.
FindComponent(BaseWeaponComponent));
1566 string weaponSlotType = comp.GetWeaponSlotType();
1569 if (!(weaponSlotType ==
"primary" || weaponSlotType ==
"secondary"))
1575 comp.GetMuzzlesList(muzzles);
1576 foreach (BaseMuzzleComponent muzzle : muzzles)
1578 if (muzzleType != -1 && muzzle.GetMuzzleType() != muzzleType)
1581 inMagMuzzle = SCR_MuzzleInMagComponent.Cast(muzzle);
1582 if (inMagMuzzle && !inMagMuzzle.CanBeReloaded())
1585 ResourceName magazineOrProjectilePrefab = muzzle.GetDefaultMagazineOrProjectileName();
1586 if (SCR_StringHelper.IsEmptyOrWhiteSpace(magazineOrProjectilePrefab))
1590 int resupplyCount = maxMagazineCount - GetMagazineCountByMuzzle(null,muzzle);
1591 if (resupplyCount <= 0)
1595 if (mustBeInStorage)
1597 arsenalStorage = SCR_ArsenalInventoryStorageManagerComponent.Cast(mustBeInStorage);
1598 if ((arsenalStorage && !arsenalStorage.IsPrefabInArsenalStorage(magazineOrProjectilePrefab)) || (!arsenalStorage && mustBeInStorage.GetDepositItemCountByResource(
GetOwner(), magazineOrProjectilePrefab) < 1))
1603 if (!validResupplyItems.Contains(magazineOrProjectilePrefab))
1604 validResupplyItems.Insert(magazineOrProjectilePrefab, resupplyCount);
1607 validResupplyItems[magazineOrProjectilePrefab] = Math.Clamp(validResupplyItems[magazineOrProjectilePrefab] + resupplyCount, 0, maxMagazineCount);
1615 void ResupplyMagazines(notnull map<ResourceName, int> validResupplyItems)
1618 if (validResupplyItems.IsEmpty())
1621 if (!m_ResupplyMagazineCallback)
1622 m_ResupplyMagazineCallback =
new SCR_ResupplyMagazinesCallback(
this);
1625 foreach (ResourceName itemPrefab,
int count : validResupplyItems)
1627 m_ResupplyMagazineCallback.Insert(itemPrefab, count);
1630 m_ResupplyMagazineCallback.Start();
1638 void ResupplyMagazines(
int maxMagazineCount = 4,
EMuzzleType muzzleType = -1, InventoryStorageManagerComponent mustBeInStorage = null)
1641 map<ResourceName, int> validResupplyItems =
new map<ResourceName, int>();
1642 GetValidResupplyItemsAndCount(validResupplyItems, maxMagazineCount, muzzleType, mustBeInStorage);
1645 ResupplyMagazines(validResupplyItems);
1650 void EndResupplyMagazines()
1652 delete m_ResupplyMagazineCallback;
1661 static bool IsItemInStorage(notnull InventoryStorageManagerComponent storage, ResourceName item,
IEntity player)
1663 SCR_ArsenalInventoryStorageManagerComponent arsenalStorage = SCR_ArsenalInventoryStorageManagerComponent.Cast(storage);
1664 return (arsenalStorage && arsenalStorage.IsPrefabInArsenalStorage(item)) || (!arsenalStorage && storage.GetDepositItemCountByResource(player, item) > 0);
1674 EResupplyUnavailableReason CanResupplyMuzzle(
IEntity user, notnull BaseMuzzleComponent muzzle,
int maxMagazineCount = -1, InventoryStorageManagerComponent mustBeInStorage = null, out
int currentMagazineAmount = -1)
1677 SCR_MuzzleInMagComponent inMagMuzzle = SCR_MuzzleInMagComponent.Cast(muzzle);
1678 if (inMagMuzzle && !inMagMuzzle.CanBeReloaded())
1679 return EResupplyUnavailableReason.NO_VALID_WEAPON;
1682 ResourceName magazineToResupply = muzzle.GetDefaultMagazineOrProjectileName();
1683 if (SCR_StringHelper.IsEmptyOrWhiteSpace(magazineToResupply))
1684 return EResupplyUnavailableReason.NO_VALID_WEAPON;
1687 if (mustBeInStorage && !IsItemInStorage(mustBeInStorage, magazineToResupply, user))
1688 return EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE;
1691 currentMagazineAmount = GetMagazineCountByMuzzle(user,muzzle);
1692 if (maxMagazineCount > 0 && currentMagazineAmount >= maxMagazineCount)
1693 return EResupplyUnavailableReason.ENOUGH_ITEMS;
1696 if (!FindStorageForResourceInsert(magazineToResupply,
m_Storage))
1697 return EResupplyUnavailableReason.INVENTORY_FULL;
1699 return EResupplyUnavailableReason.RESUPPLY_VALID;
1709 EResupplyUnavailableReason CanResupplyItem(
IEntity user, ResourceName itemToResupply,
int maxItemCount = -1, InventoryStorageManagerComponent mustBeInStorage = null, out
int currentItemAmount = -1)
1712 if (mustBeInStorage && !IsItemInStorage(mustBeInStorage, itemToResupply, user))
1713 return EResupplyUnavailableReason.NOT_IN_GIVEN_STORAGE;
1716 currentItemAmount = GetDepositItemCountByResource(user, itemToResupply);
1717 if (maxItemCount > 0 && currentItemAmount >= maxItemCount)
1718 return EResupplyUnavailableReason.ENOUGH_ITEMS;
1721 if (!FindStorageForResourceInsert(itemToResupply,
m_Storage))
1722 return EResupplyUnavailableReason.INVENTORY_FULL;
1724 return EResupplyUnavailableReason.RESUPPLY_VALID;
1731 void MoveItemToVicinity(
IEntity pItem, BaseInventoryStorageComponent pStorageTo = null);
1735 void OpenInventory()
1737 if (!m_bInventoryAccessAllowed)
1743 MenuManager menuManager =
GetGame().GetMenuManager();
1751 m_OnInventoryOpenInvoker.Invoke(
true);
1773 void CloseInventory()
1775 MenuManager menuManager =
GetGame().GetMenuManager();
1786 IEntity result = m_StorageToOpen;
1787 m_StorageToOpen = null;
1794 void SetStorageToOpen(
IEntity storage)
1796 m_StorageToOpen = storage;
1801 void Action_OpenInventory()
1803 CompartmentAccessComponent cac =
m_CharacterController.GetCharacter().GetCompartmentAccessComponent();
1804 if (cac && cac.IsInCompartment())
1806 IEntity owner = cac.GetCompartment().GetOwner();
1809 UniversalInventoryStorageComponent comp = UniversalInventoryStorageComponent.Cast(owner.
FindComponent(UniversalInventoryStorageComponent));
1812 SetStorageToOpen(owner);
1820 if (cac && (cac.IsGettingIn() || cac.IsGettingOut()))
1827 void OnInventoryMenuClosed()
1829 m_OnInventoryOpenInvoker.Invoke(
false);
1839 override void OnStorageAdded(BaseInventoryStorageComponent storage)
1855 void DebugListAllItemsInInventory()
1857 array<IEntity> items = {};
1860 InventoryItemComponent pInvComp;
1861 ItemAttributeCollection attribs;
1862 foreach (
IEntity item : items)
1864 pInvComp = InventoryItemComponent.Cast( item .FindComponent( InventoryItemComponent ) );
1867 attribs = pInvComp.GetAttributes();
1871 string sName = attribs.GetUIInfo().GetName();
1880 void EnablePostFrame(
bool enable)
1890 int GetHealthComponentCount()
1892 return m_iHealthEquipment;
1904 void ~SCR_InventoryStorageManagerComponent()
1906 m_ERetCode = EInventoryRetCode.RETCODE_DEFAULT_STATE;
1911 bool IsAnimationReady()
1920 bool IsInventoryLocked()
1922 return m_bIsInventoryLocked;
1927 void SetInventoryLocked(
bool isLocked)
1929 m_bIsInventoryLocked = isLocked;
1936 int GetAllItems(inout array<IEntity> items, BaseInventoryStorageComponent storage)
1938 if (!storage || !items)
1943 if (!ClothNodeStorageComponent.Cast(storage))
1944 count = storage.GetAll(items);
1946 array<BaseInventoryStorageComponent> itemToReplaceAttachedStorages = {};
1947 storage.GetOwnedStorages(itemToReplaceAttachedStorages, 1,
false);
1948 foreach (BaseInventoryStorageComponent attachedStorage : itemToReplaceAttachedStorages)
1950 if (ClothNodeStorageComponent.Cast(attachedStorage))
1951 attachedStorage.GetOwnedStorages(itemToReplaceAttachedStorages, 1,
false);
1953 count += attachedStorage.GetAll(items);
1964 void GetWeaponPrefabsOfType(notnull array<IEntity> weapons,
EWeaponType weaponType, notnull out array<EntityPrefabData> prefabs)
1966 BaseWeaponComponent weapon;
1967 EntityPrefabData prefabData;
1968 foreach (
IEntity item : weapons)
1970 weapon = BaseWeaponComponent.Cast(item.FindComponent(BaseWeaponComponent));
1971 if (weapon.GetWeaponType() != weaponType)
1975 prefabData = item.GetPrefabData();
1976 if (prefabData && !prefabs.Contains(prefabData))
1977 prefabs.Insert(prefabData);
1989 array<EntityPrefabData> prefabs = {};
1992 EntityPrefabData currentPrefab;
1993 BaseWeaponComponent currentWeapon;
1996 currentPrefab = currentItem.GetPrefabData();
1997 currentWeapon = BaseWeaponComponent.Cast(currentItem.FindComponent(BaseWeaponComponent));
1999 if (currentPrefab && currentWeapon.GetWeaponType() == weaponType)
2000 prefabs.Insert(currentPrefab);
2004 array<IEntity> items = {};
2005 FindItemsWithComponents(items, {BaseWeaponComponent});
2006 GetWeaponPrefabsOfType(items, weaponType, prefabs);
2009 if (prefabs.IsEmpty())
2021 int nextPrefabID = (prefabs.Find(currentPrefab) + 1) % prefabs.Count();
2022 EntityPrefabData nextPrefab = prefabs[nextPrefabID];
2025 if (!allowCurrentPrefab && nextPrefab == currentPrefab)
2029 foreach (
IEntity item : items)
2031 if (item && item.GetPrefabData() == nextPrefab)
2039 void AllowInventoryAccess(
bool allow)
2041 m_bInventoryAccessAllowed = allow;
2048 void SetReturnCode( EInventoryRetCode ERetCode ) ;
2051 void SetReturnCodeDefault() ;
2055 EInventoryRetCode GetReturnCode()
2062 float GetTotalWeightOfAllStorages();
2066 void SetLootStorage(
IEntity pOwner );
2078 void EquipWeapon(
IEntity pOwnerEntity, SCR_InvCallBack cb = null,
bool bFromVicinity =
true );
2083 void EquipGadget(
IEntity pOwnerEntity );
2088 void EquipCloth(
IEntity pOwnerEntity );
2095 void EquipAny(BaseInventoryStorageComponent storage,
IEntity item,
int preferred = 0);
2101 void EquipItem( EquipedWeaponStorageComponent weaponStorage,
IEntity weapon );
2105 void OpenInventory();
2109 void Action_OpenInventory();
2112 override void OnStorageAdded(BaseInventoryStorageComponent storage);
2117 void EnablePostFrame(
bool enable);
2121 int GetHealthComponentCount();
2134 void SCR_InventoryStorageManagerComponent(IEntityComponentSource src,
IEntity ent,
IEntity parent)
2136 #ifndef DISABLE_INVENTORY
2141 m_Storage = SCR_CharacterInventoryStorageComponent.Cast(ent.
FindComponent(CharacterInventoryStorageComponent));
@ NOT_ENOUGH_AVAILABLE_ALLOCATED_SUPPLIES
If Military Supply Allocation is enabled and player does not have enough Available Allocated Supplies...
@ RANK_TOO_LOW
If player ranks are enabled and player has too low of a rank.
ArmaReforgerScripted GetGame()
void Start()
Start this tracking time in this menu, adds it to previous time if we have not yet sended previous da...
void OnItemAdded(BaseInventoryStorageComponent storageOwner, IEntity item)
void OnItemRemoved(BaseInventoryStorageComponent storageOwner, IEntity item)
SCR_EArsenalItemType m_eItemType
SCR_CharacterPerceivableComponentClass m_CharacterController
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_EConsumableType
Type of consumable gadget.
SCR_InventoryStorageManagerComponentClass RETCODE_OK
SCR_InventoryStorageManagerComponentClass RETCODE_ITEM_TOO_HEAVY
SCR_InventoryStorageManagerComponentClass RETCODE_ITEM_TOO_BIG
ScriptInvokerBase< ScriptInvokerBoolMethod > ScriptInvokerBool
BaseInventoryStorageComponent m_Storage
void SCR_UniversalInventoryStorageComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
enum EVehicleType IEntity
bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array< GenericComponent > queriedComponents, array< BaseItemAttributeData > queriedAttributes)
proto external Managed FindComponent(typename typeName)
proto external EntityPrefabData GetPrefabData()
proto external IEntity GetParent()
proto external bool IsDeleted()
bool CanApplyEffectToHZ(notnull IEntity target, notnull IEntity user, ECharacterHitZoneGroup group, out SCR_EConsumableFailReason failReason=SCR_EConsumableFailReason.NONE)
proto external int GetEventIndex(string name)
IEntity GetOwner()
Owner entity of the fuel tank.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
@ NONE
When Shape is created and not initialized yet.
EntityEvent
Various entity events.
ref BaseInventoryTask InsertItem(IEntity item, int slotID, bool justSpawned)
event bool CanReplaceItem(IEntity nextItem, int slotID)
Implemented logics for can replace to nextItem at slotID,.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
proto int Insert(T value)