13 CharacterControllerComponent m_Controller;
18 m_Controller.TryEquipRightHandItem(m_pItem,
EEquipItemType.EEquipTypeWeapon,
false);
37 m_InvMan.EquipWeapon(m_pItem, null,
false);
55 m_pMenu.ShowStoragesList();
56 m_pMenu.ShowAllStoragesInList();
69 if (!characterStorage || !m_pItem)
72 if (m_iSlotToFocus > -1)
85 m_pStorageToPickUp = null;
99 #ifndef DISABLE_INVENTORY
101 private BaseInventoryStorageComponent m_LootStorage;
102 protected ref array<ref SCR_QuickslotBaseContainer>
m_aQuickSlots = { null, null, null, null, null, null, null, null, null, null };
179 IEntity entity = slot.GetAttachedEntity();
203 void GetStorages( out notnull array<SCR_UniversalInventoryStorageComponent> storagesInInventory )
205 array<IEntity> pEntities = {};
206 int iNrOfStorages =
GetAll( pEntities );
209 foreach (
IEntity pEntity: pEntities )
213 storagesInInventory.Insert( pUniComp );
229 if ( pEntity == null )
241 m_LootStorage = null;
245 m_LootStorage = BaseInventoryStorageComponent.Cast(pOwner.
FindComponent(BaseInventoryStorageComponent));
252 return m_LootStorage;
288 if ( weaponComponent )
290 iItemType = weaponComponent.GetWeaponType();
295 SCR_GadgetComponent gadgetComponent = SCR_GadgetComponent.Cast( pItem.FindComponent( SCR_GadgetComponent ) );
296 if ( gadgetComponent )
298 EGadgetType gadgetType = gadgetComponent.GetType();
299 int consumableOffset = 0;
300 if (gadgetType == EGadgetType.CONSUMABLE)
302 SCR_ConsumableItemComponent consumable = SCR_ConsumableItemComponent.Cast(gadgetComponent);
304 consumableOffset = consumable.GetConsumableType();
306 iItemType = gadgetComponent.GetType() +
GADGET_OFFSET + consumableOffset;
349 if (allowedTypes.Contains(itemType))
381 if ( iSlotIndex == -1 )
386 parentSlot = itemComp.GetParentSlot();
390 iSlotIndex = parentSlot.GetID();
414 if ( iSlotIndex == -1 )
420 if (turretCompartment)
425 array<IEntity> turretWeapons = {};
427 if (turretWeapons.Contains(pItem))
433 if ( entityContainer && pItem == entityContainer.GetEntity() )
489 array<IEntity> entities = {};
495 if (!entityContainer)
497 entities.Insert(null);
501 entities.Insert(entityContainer.GetEntity());
516 if (!entityContainer)
519 return entityContainer.GetEntity();
541 CharacterControllerComponent controller = character.GetCharacterController();
545 IEntity gadget = controller.GetAttachedGadgetAtLeftHandSlot();
551 return weapon.GetOwner();
575 CharacterControllerComponent controller = character.GetCharacterController();
579 if (controller.IsChangingItem())
582 if (controller.IsGadgetInHands())
583 controller.RemoveGadgetFromHand();
585 controller.SelectWeapon(null);
596 CharacterControllerComponent controller = character.GetCharacterController();
600 if (controller.IsChangingItem())
603 SCR_InventoryStorageManagerComponent storageManager = SCR_InventoryStorageManagerComponent.Cast(controller.GetInventoryStorageManager());
610 if (controller.IsGadgetInHands())
613 itemEnt = controller.GetAttachedGadgetAtLeftHandSlot();
614 storageManager.TryRemoveItemFromInventory(itemEnt);
618 BaseWeaponManagerComponent weaponManager = controller.GetWeaponManagerComponent();
626 SCR_EquipNextGrenadeCB callback =
new SCR_EquipNextGrenadeCB();
629 itemEnt = currentSlot.GetWeaponEntity();
631 if (!storageManager.CanMoveItem(itemEnt))
634 callback.m_InvMan = storageManager;
637 callback.m_pItem = storageManager.FindNextWeaponOfType(
type, itemEnt,
true);
639 storageManager.SetInventoryLocked(
true);
640 controller.DropWeapon(currentSlot);
641 storageManager.SetInventoryLocked(
false);
650 super.OnAddedToSlot(item, slotID);
659 #ifdef DEBUG_INVENTORY20
669 if (!storageComponent)
676 UIInfo UIinfoItem = attr.GetUIInfo();
680 Print(
string.Format(
"INV: item %1 was added. It's weight is: %2, and total weight of item/storage is: %3", UIinfoItem.GetName(), attr.GetWeight(), storageComponent.GetTotalWeight()),
LogLevel.NORMAL);
687 super.OnRemovedFromSlot(item, slotID);
704 array<typename> blockedSlots = {};
706 loadoutComp.GetBlockedSlots(blockedSlots);
708 if (blockedSlots.IsEmpty())
713 foreach (
typename blockedSlot: blockedSlots)
720 foreach (
typename blockedSlot: blockedSlots)
749 if (armorAttr && damageMgr)
784 CharacterControllerComponent charCtrl = character.GetCharacterController();
788 if (charCtrl.GetCurrentItemInHands() == item || charCtrl.GetInputContext().GetLeftHandGadgetEntity() == item)
792 if (SCR_GadgetComponent.Cast(component))
810 if (charCtrl.IsChangingItem())
829 CharacterControllerComponent controller = character.GetCharacterController();
837 else if (item.FindComponent(SCR_GadgetComponent))
845 switch (slotFunction)
854 if (!character.IsInVehicle())
867 SCR_ConsumableItemComponent consumableComp = SCR_ConsumableItemComponent.Cast(item.FindComponent(SCR_ConsumableItemComponent));
870 return (consumableComp
871 && consumableComp.GetConsumableEffect()
872 && consumableComp.GetConsumableEffect().CanApplyEffect(character, character));
876 SCR_GadgetComponent gadgetComp = SCR_GadgetComponent.Cast(item.FindComponent(SCR_GadgetComponent));
877 return (gadgetComp.GetMode() == EGadgetMode.IN_HAND && gadgetComp.GetUseMask() &
SCR_EUseContext.FROM_INVENTORY);
896 CharacterControllerComponent controller = character.GetCharacterController();
903 if (item.FindComponent(SCR_GadgetComponent))
911 switch (slotFunction)
915 if (!character.IsInVehicle())
926 return currentWeapon && currentWeapon.GetOwner();
930 return controller.GetCanFireWeapon();
938 return controller.CanEquipGadget(item);
959 if (item.FindComponent(SCR_GadgetComponent))
971 switch (slotFunction)
977 SCR_MagazinePredicate predicate =
new SCR_MagazinePredicate();
979 array<IEntity> magazines = {};
983 invMan.FindItems(magazines, predicate);
985 foreach (
IEntity nextMag : magazines)
999 CharacterControllerComponent controller = character.GetCharacterController();
1011 if (turretCompartment)
1014 if (!turretController)
1017 array<WeaponSlotComponent> turretWeaponSlots = {};
1021 if (weaponSlot.GetWeaponEntity() == item)
1022 return turretController.SelectWeapon(character, weaponSlot);
1027 SCR_InventoryStorageManagerComponent inventoryManager = SCR_InventoryStorageManagerComponent.Cast(controller.GetInventoryStorageManager());
1028 if (!inventoryManager)
1032 BaseWeaponManagerComponent manager = controller.GetWeaponManagerComponent();
1034 currentWeapon = manager.GetCurrentWeapon();
1042 else if (currentWeapon && itemWeapon && currentWeapon.GetWeaponType() == itemWeapon.GetWeaponType() &&
WEAPON_TYPES_THROWABLE.Contains(itemWeapon.GetWeaponType()))
1045 IEntity nextGrenade = inventoryManager.FindNextWeaponOfType(itemWeapon.GetWeaponType(), currentWeapon.GetOwner());
1050 else if (currentWeapon && currentWeapon.GetOwner() == item && !controller.IsGadgetInHands())
1053 int nextMuzzleID =
SCR_WeaponLib.GetNextMuzzleID(currentWeapon);
1054 if (nextMuzzleID != -1)
1055 return controller.SetMuzzle(nextMuzzleID);
1080 SCR_GadgetComponent gadgetComp = SCR_GadgetComponent.Cast(item.FindComponent(SCR_GadgetComponent));
1081 if (gadgetComp.GetMode() == EGadgetMode.IN_HAND && gadgetComp.GetUseMask() !=
SCR_EUseContext.NONE)
1083 gadgetComp.ToggleActive(!gadgetComp.IsToggledOn(), context);
1106 SCR_InventoryStorageManagerComponent storageMgr = SCR_InventoryStorageManagerComponent.Cast(character.GetCharacterController().GetInventoryStorageManager());
1108 storageMgr.EquipAny(
this, item, -1, cb);
1116 SCR_InventoryStorageManagerComponent storageMgr = SCR_InventoryStorageManagerComponent.Cast(character.GetCharacterController().GetInventoryStorageManager());
1118 storageMgr.EquipAny(
this, item, -1, cb);
1133 if (!currentWeapon.IsReloadPossible())
1141 if (!currentMagWell)
1152 if (magazineWell.Type() == currentMagWell.Type())
1168 CharacterControllerComponent controller = character.GetCharacterController();
1172 return controller.ReloadWeaponWith(item);
1182 CharacterControllerComponent controller = character.GetCharacterController();
1186 BaseWeaponManagerComponent weaponManager = controller.GetWeaponManagerComponent();
1188 weaponManager.GetWeaponsList(outWeapons);
1198 CompartmentAccessComponent compAccess = character.GetCompartmentAccessComponent();
1199 if (!compAccess || !compAccess.IsInCompartment())
1202 return compAccess.GetCompartment();
1216 BaseWeaponManagerComponent weaponManager = controller.GetWeaponManager();
1220 return weaponManager.GetCurrentWeapon();
1228 return turretWeapon;
1234 CharacterControllerComponent controller = character.GetCharacterController();
1238 BaseWeaponManagerComponent weaponManager = controller.GetWeaponManagerComponent();
1242 return weaponManager.GetCurrentWeapon();
1290 if (currentWeaponComponent)
1291 currentWeapon = currentWeaponComponent.GetOwner();
1297 int currentSlot = -1;
1298 for (
int i; i < maxSlots; i++)
1310 for (
int i; i < maxSlots; i++)
1312 nextSlot = (currentSlot + i + 1) % maxSlots;
1314 if (nextSlot == currentSlot)
1326 for (
int i; i < maxSlots; i++)
1347 CharacterControllerComponent controller = character.GetCharacterController();
1351 SCR_InventoryStorageManagerComponent
pInventoryManager = SCR_InventoryStorageManagerComponent.Cast(controller.GetInventoryStorageManager());
1357 array<IEntity> initSlotItems = {};
1359 foreach (
IEntity item : initSlotItems)
1389 if (compartmentSlot)
1392 OnCompartmentSlotEntered(compartmentSlot);
1416 if (!SCR_ConsumableItemComponent.Cast(item.
FindComponent(SCR_ConsumableItemComponent)))
1421 if (quickSlot == -1)
1429 t = SCR_GadgetComponent;
1431 SCR_ItemTypeSearchPredicate itemSearch =
new SCR_ItemTypeSearchPredicate(t, itemType, item);
1432 array<IEntity> items = {};
1438 invMan.FindItems(items, itemSearch);
1440 if (!items.IsEmpty())
1463 if (!entityContainer)
1478 SCR_InventoryStorageManagerComponent
pInventoryManager = SCR_InventoryStorageManagerComponent.Cast(
GetOwner().FindComponent( SCR_InventoryStorageManagerComponent));
1484 if (!quickSlotEntity)
1493 SCR_WeaponSwitchingBaseUI.RefreshQuickSlots();
1498 array<WeaponSlotComponent> turretWeaponSlots = {};
1503 foreach (
int i, WeaponSlotComponent weaponSlot: turretWeaponSlots)
1505 IEntity weaponSlotEntity = weaponSlot.GetWeaponEntity();
1506 if (!weaponSlotEntity)
1513 SCR_WeaponSwitchingBaseUI.RefreshQuickSlots();
1527 OnCompartmentSlotEntered(compartment);
1549 if (!entityContainer)
1564 SCR_InventoryStorageManagerComponent
pInventoryManager = SCR_InventoryStorageManagerComponent.Cast(
GetOwner().FindComponent( SCR_InventoryStorageManagerComponent));
1570 if (!quickSlotEntity)
1598 if (!turretController)
1601 BaseWeaponManagerComponent weaponManager = turretController.GetWeaponManager();
1603 return weaponManager.GetWeaponsList(weaponsList);
1612 if (!turretController)
1615 BaseWeaponManagerComponent weaponManager = turretController.GetWeaponManager();
1617 return weaponManager.GetWeaponsSlots(weaponSlots);
1631 if (entityContainer && entityContainer.GetEntity() == entity)
1649 if (entityContainer && entityContainer.GetEntity())
1651 testedEntity = entityContainer.GetEntity();
1656 if (itemComponent.GetAttributes().GetCommonType() !=
type)
1674 array<IEntity> allItems = {};
1677 SCR_ItemOutfitFactionComponent outfitComponent;
1680 foreach (
IEntity item : allItems)
1698 SCR_ItemOutfitFactionComponent outfitComponent = SCR_ItemOutfitFactionComponent.Cast(item.
FindComponent(SCR_ItemOutfitFactionComponent));
1699 if (!outfitComponent)
1736 void GetStorages( out notnull array<SCR_UniversalInventoryStorageComponent> storagesInInventory );
ArmaReforgerScripted GetGame()
SCR_EArsenalItemType GetItemType()
SCR_EquipGearCB m_CharacterStorage
enum EItemType ComponentEditorProps(category:"GameScripted/Inventory", description:"Inventory 2.0", icon:HYBRID_COMPONENT_ICON)
SCR_EConsumableType
Type of consumable gadget.
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SCR_QuickslotEntityContainer(IEntity entity)
array< ref SCR_TaskFinishEntry > GetAll()
SCR_InventoryStorageManagerComponent pInventoryManager
void SCR_UniversalInventoryStorageComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
ref OnItemUseEndedInvoker m_OnItemUseEndedInvoker
void UpdateArmorDataMap(notnull SCR_ArmoredClothItemData armorAttr, bool remove)
If !remove, take data from prefab and insert to map as class. If remove, remove this hitZone's stored...
static const ref array< EWeaponType > WEAPON_TYPES_THROWABLE
bool CanEquipItem_Inventory(notnull IEntity item)
void UpdateBlockedSlots(IEntity item, int slotID, bool added)
void SetStorageAsShown(notnull BaseInventoryStorageComponent pStorage)
bool UseItem(notnull IEntity item, ESlotFunction slotFunction=ESlotFunction.TYPE_GENERIC, SCR_EUseContext context=SCR_EUseContext.FROM_QUICKSLOT)
void HandleOnItemAddedToInventory(IEntity item, BaseInventoryStorageComponent storageOwner)
bool IsAreaBlocked(typename areaType)
int StoreItemToQuickSlot(notnull IEntity pItem, int iSlotIndex=-1, bool isForced=false)
bool HasStorageComponent(IEntity pEntity)
int RemoveItemFromQuickSlot(IEntity pItem)
int GetEntityIndexInQuickslots(notnull IEntity entity)
void OnItemUsed(IEntity item, bool successful, ItemUseParameters animParams)
array< IEntity > GetQuickSlotEntitiesOnly()
gets all entities in quickslots, and nulls in arrays for non-entity or empty slots
IEntity SelectNextWeapon(int maxSlot=-1)
Select next weapon.
bool ReloadCurrentWeapon(IEntity item)
int GetFirstSlotIndexOf(ECommonItemType type)
void RemoveItemsFromWeaponQuickSlots()
void EditArmoredAttributes(IEntity item, int slotID, bool remove=false)
Take the data from the armor attribute, and store them in map on damagemanager.
BaseInventoryStorageComponent m_WeaponStorage
void GetBlockedSlots(out notnull array< typename > blockedSlots)
int GetTurretWeaponSlots(BaseCompartmentSlot compartment, out array< WeaponSlotComponent > weaponSlots)
IEntity GetSelectedItem()
bool GetIsStorageShown(notnull BaseInventoryStorageComponent pStorage)
void InitAsPlayer(IEntity pOwner, bool pControlled)
static const int TURRET_WEAPON_SWITCH_SLOTS
ref array< typename > m_aBlockedSlots
ref map< IEntity, int > m_mSlotHistory
ref array< IEntity > m_aWeaponQuickSlotsStorage
bool CanUseItem_Inventory(notnull IEntity item, ESlotFunction slotFunction=ESlotFunction.TYPE_GENERIC)
static int GetItemType(notnull IEntity pItem)
bool CanReloadCurrentWeapon(notnull IEntity item)
bool SetQuickSlotInitialized(int iSlotIndex)
ref array< int > m_aQuickSlotsHistory
SCR_CharacterFactionAffiliationComponent m_CharacterAffiliationComponent
BaseInventoryStorageComponent GetWeaponStorage()
void InsertContainerIntoQuickslot(SCR_QuickslotBaseContainer container, int slotIndex)
void GetPlayersWeapons(notnull inout array< IEntity > outWeapons)
void OnCompartmentEntered(IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
BaseInventoryStorageComponent GetLootStorage()
ref set< int > m_aQuickSlotsInitalized
void HandleOnItemRemovedFromInventory(IEntity item, BaseInventoryStorageComponent storageOwner)
void UpdatePerceivedFaction(bool addedToSlot, IEntity item, bool updateFaction=true)
BaseCompartmentSlot GetCurrentCompartment()
override void OnRemovedFromSlot(IEntity item, int slotID)
BaseWeaponComponent GetCurrentCharacterWeapon()
IEntity GetItemFromQuickSlot(int index)
ref array< BaseInventoryStorageComponent > m_aStoragesInStorageList
static const ref array< ref array< int > > DEFAULT_QUICK_SLOTS
override void OnAddedToSlot(IEntity item, int slotID)
void InitCharacterPerceivedOutfitData(notnull SCR_CharacterFactionAffiliationComponent characterAffiliationComponent)
static int GetDefaultQuickSlot(notnull IEntity item)
bool ItemBelongsToSlot(int iItemType, int iSlotIndex)
void RemoveItemFromQuickSlotAtIndex(int index)
BaseWeaponComponent GetCurrentTurretWeapon()
array< ref SCR_QuickslotBaseContainer > GetQuickSlotItems()
static const int GADGET_OFFSET
void OnCompartmentLeft(IEntity targetEntity, BaseCompartmentManagerComponent manager, int mgrID, int slotID, bool move)
void UnequipCurrentItem()
Unequip currently held item. Not allowed while switching to another item.
ref array< ref SCR_QuickslotBaseContainer > m_aQuickSlots
BaseWeaponComponent GetCurrentWeapon()
IEntity GetNextWeapon(int maxSlots=-1)
Get next weapon up to specified maximum.
InventoryItemComponent GetItemFromLoadoutSlot(LoadoutAreaType eSlot)
void SetLootStorage(IEntity pOwner)
SCR_CompartmentAccessComponent m_CompartmentAccessComp
void DropCurrentItem()
Drop currently held item. Not allowed while switching to another item.
int GetTurretWeaponsList(BaseCompartmentSlot compartment, out array< IEntity > weaponsList)
ref SCR_InvEquipCB m_Callback
int GetLastQuickSlotId(IEntity ent)
void SetStorageAsHidden(notnull BaseInventoryStorageComponent pStorage)
void GetStorages(out notnull array< SCR_UniversalInventoryStorageComponent > storagesInInventory)
SCR_UniversalInventoryStorageComponent GetStorageComponentFromEntity(IEntity pEntity)
bool IsInDefaultQuickSlot(notnull IEntity item)
SCR_QuickslotBaseContainer GetContainerFromQuickslot(int index)
BaseInventoryStorageComponent GetStorageFromLoadoutSlot(LoadoutAreaType eSlot)
static const int INFANTRY_WEAPON_SWITCH_SLOTS
bool CanUseItem(notnull IEntity item, ESlotFunction slotFunction=ESlotFunction.TYPE_GENERIC)
override void OnComplete()
void SetGadgetMode(IEntity gadget, EGadgetMode targetMode, bool doFocus=false)
static SCR_GadgetManagerComponent GetGadgetManager(IEntity entity)
void RemoveHeldGadget()
Remove gadget held in hand.
override void OnComplete()
override void OnComplete()
SCR_QuickslotBaseContainer is intended to be used for quickslots, to allow quickslotting of non-item ...
static void HighlightQuickSlot(int id, bool highlight=true)
static void RefreshQuickSlots(int id=-1)
UIInfo - allows to define UI elements.
IEntity GetOwner()
Owner entity of the fuel tank.
HYBRID_COMPONENT_ICON
Default icon for all components written in script that don't inherit ScriptComponent.
proto external bool CanUseItem()
Returns true if the character can use an item.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EquipedLoadoutStorageComponentClass ScriptedBaseInventoryStorageComponentClass GetSlotFromArea(typename pAreaType)
Get the first slot that satisfies the condition : "slot area type is inherited by pAreaType".
proto external IEntity GetClothFromArea(typename pAreaType)
Get the first cloth entity that satisfies the condition : "slot area type is inherited by pAreaType A...
proto external sealed InventoryStorageSlot FindItemSlot(IEntity item)
proto bool Contains(T value)