Arma Reforger Script API
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
InventoryStorageManagerComponent Interface Reference
Inheritance diagram for InventoryStorageManagerComponent:
[legend]

Public Member Functions

proto external IEntity GetOwner ()
 
proto external void AddStorage (BaseInventoryStorageComponent storage)
 
proto external bool CanInsertItem (IEntity item, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY)
 Will iterate over storages and find if item can be inserted in first best match.
 
proto external bool CanInsertItemInStorage (IEntity item, BaseInventoryStorageComponent storage, int slotID=-1)
 
proto external bool CanInsertResource (ResourceName resourceName, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY, int count=1)
 Will iterate over storages and find if item can be inserted in first best match.
 
proto external bool CanInsertResourceInStorage (ResourceName resourceName, BaseInventoryStorageComponent storage, int slotID=-1, int count=1)
 
proto external bool TryInsertItem (IEntity item, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY, InventoryOperationCallback cb=null)
 Will iterate over storages and try insert the item at first best match.
 
proto external bool TryInsertItemInStorage (IEntity item, BaseInventoryStorageComponent storage, int slotID=-1, InventoryOperationCallback cb=null)
 Will try to insert item at storage. If slotID -1 will try to insert in any free storage.
 
proto external bool CanReplaceItem (IEntity item, BaseInventoryStorageComponent storage, int slotID)
 Same as insert, only should allow replacing item at storage slot, slotID is required.
 
proto external bool TryReplaceItem (IEntity item, BaseInventoryStorageComponent storage, int slotID, InventoryOperationCallback cb=null)
 
proto external bool CanRemoveItemFromStorage (IEntity item, BaseInventoryStorageComponent storage)
 
proto external bool TryRemoveItemFromStorage (IEntity item, BaseInventoryStorageComponent storage, InventoryOperationCallback cb=null)
 Will try to remove item from storage.
 
proto external bool CanMoveItemToStorage (IEntity item, BaseInventoryStorageComponent to, int slotID=-1)
 
proto external bool TryMoveItemToStorage (IEntity item, BaseInventoryStorageComponent to, int slotID=-1, InventoryOperationCallback cb=null)
 Will try to move item from source storage to target storage.
 
proto external bool CanSwapItemStorages (IEntity itemA, IEntity itemB)
 
proto external bool TrySwapItemStorages (IEntity itemA, IEntity itemB, InventoryOperationCallback cb=null)
 Will try to place itemA to itemB storage slot and itemB to itemA storage slot.
 
proto external bool TryDeleteItem (IEntity item, InventoryOperationCallback cb=null)
 
proto external bool TrySpawnPrefabToStorage (ResourceName prefab, BaseInventoryStorageComponent storage=null, int slotID=-1, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY, InventoryOperationCallback cb=null, int count=1)
 Spawn and insert into inventory if provided storage is null then most suitable storage would be chosen from owned storages.
 
proto external bool ValidateStorageRequest (IEntity storageOwner)
 Validate that the storage is near the player to eliminate potentual message tampering.
 
proto external int GetStorages (out notnull array< BaseInventoryStorageComponent > outStorages, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY)
 Get all managed storages.
 
proto external int GetItems (out notnull array< IEntity > outItems)
 Get all items from all managed storages.
 
proto external bool Contains (IEntity item)
 Returns true if item is in the storage, false otherwise.
 
proto external BaseInventoryStorageComponent FindStorageForItem (IEntity item, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY)
 Will try to find suitable storage for item.
 
proto external BaseInventoryStorageComponent FindStorageForResource (ResourceName resourceName, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY)
 Will try to find suitable storage for resource.
 
proto external BaseInventoryStorageComponent FindStorageForInsert (IEntity item, BaseInventoryStorageComponent fromStorage, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY)
 returns first storage with empty space from provided storage hierarchy for provided item and provided storage purpose
 
proto external BaseInventoryStorageComponent FindStorageForResourceInsert (ResourceName resourceName, BaseInventoryStorageComponent fromStorage, EStoragePurpose purpose=EStoragePurpose.PURPOSE_ANY)
 returns first storage with empty space from provided storage hierarchy for provided resource and provided storage purpose
 
proto external int GetDepositItemCountByEntity (IEntity verifier, IEntity entity)
 Fast access to item count in inventory (returns only items that are stored in DEPOSIT storages)
 
proto external int GetDepositItemCountByResource (IEntity verifier, ResourceName resourceName)
 Fast access to item count in inventory (returns only items that are stored in DEPOSIT storages)
 
proto external IEntity FindItem (InventorySearchPredicate predicate, EStoragePurpose purpose=EStoragePurpose.PURPOSE_DEPOSIT)
 Find Item by providing InventorySearchPredicate object.
 
proto external int FindItems (out notnull array< IEntity > foundItems, InventorySearchPredicate predicate, EStoragePurpose purpose=EStoragePurpose.PURPOSE_DEPOSIT)
 
proto external IEntity FindItemWithComponents (array< TypeName > componentsQuery, EStoragePurpose purpose=EStoragePurpose.PURPOSE_DEPOSIT)
 Find Item by specifying necessary component types (eg returns first Entity that contains all of the provided components) IEntity FindGrenadeInDeposit() { array<typename> components = {}; components.Insert(WeaponComponent); components.Insert(GrenadeMoveComponent); IEntity grenade = inventoryStorageManagerComponent.FindItemWithComponents(components, EStoragePurpose.PURPOSE_DEPOSIT); Print(grenade); return grenade; }.
 
proto external int FindItemsWithComponents (out notnull array< IEntity > foundItems, array< TypeName > componentsQuery, EStoragePurpose purpose=EStoragePurpose.PURPOSE_DEPOSIT)
 Find Items by specifying necessary component types (eg all Entities that contain all of the provided components), returns count of found items.
 
proto external int CountItem (InventorySearchPredicate predicate, EStoragePurpose purpose=EStoragePurpose.PURPOSE_DEPOSIT)
 
proto external int GetMagazineCountByWeapon (BaseWeaponComponent weapon)
 Find Items by specifying necessary component types (eg all Entities that contain all of the provided components), returns count of found items.
 
proto external int GetMagazineCountByMuzzle (IEntity verifier, BaseMuzzleComponent pMuzzle)
 Find Items by specifying necessary component types (eg all Entities that contain all of the provided components), returns count of found items.
 
proto external int GetGrenadesCount ()
 
void OnDelete (IEntity owner)
 
- Public Member Functions inherited from GameComponent
bool OnTicksOnRemoteProxy ()
 

Protected Member Functions

void OnItemAdded (BaseInventoryStorageComponent storageOwner, IEntity item)
 Callback when item is added (will be performed locally after server completed the Insert/Move operation)
 
void OnItemRemoved (BaseInventoryStorageComponent storageOwner, IEntity item)
 Callback when item is removed (will be performed locally after server completed the Remove/Move operation)
 
void OnStorageAdded (BaseInventoryStorageComponent storage)
 Will be called when new storage is registered at manager.
 
void OnStorageRemoved (BaseInventoryStorageComponent storage)
 Will be called when storage is unregistered from manager.
 
void FillInitialStorages (out array< BaseInventoryStorageComponent > storagesToAdd)
 Override this method and fill in storagesToAdd array if you have some storages you'd like to register to manager as owned at initialization time.
 
void FillInitialPrefabsToStore (out array< ResourceName > prefabsToSpawn)
 Override this method and fill in prefabsToSpawn array if you have some items you'd like to store in inventory at initialization time.
 
bool ShouldForbidRemoveByInstigator (InventoryStorageManagerComponent instigatorManager, BaseInventoryStorageComponent fromStorage, IEntity item)
 Virtual method that allows verification of item removal as a result of move operation on inventory level.
 

Member Function Documentation

◆ AddStorage()

proto external void InventoryStorageManagerComponent.AddStorage ( BaseInventoryStorageComponent  storage)

◆ CanInsertItem()

proto external bool InventoryStorageManagerComponent.CanInsertItem ( IEntity  item,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY 
)

Will iterate over storages and find if item can be inserted in first best match.

◆ CanInsertItemInStorage()

proto external bool InventoryStorageManagerComponent.CanInsertItemInStorage ( IEntity  item,
BaseInventoryStorageComponent  storage,
int  slotID = -1 
)

◆ CanInsertResource()

proto external bool InventoryStorageManagerComponent.CanInsertResource ( ResourceName  resourceName,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY,
int  count = 1 
)

Will iterate over storages and find if item can be inserted in first best match.

◆ CanInsertResourceInStorage()

proto external bool InventoryStorageManagerComponent.CanInsertResourceInStorage ( ResourceName  resourceName,
BaseInventoryStorageComponent  storage,
int  slotID = -1,
int  count = 1 
)

◆ CanMoveItemToStorage()

proto external bool InventoryStorageManagerComponent.CanMoveItemToStorage ( IEntity  item,
BaseInventoryStorageComponent  to,
int  slotID = -1 
)

◆ CanRemoveItemFromStorage()

proto external bool InventoryStorageManagerComponent.CanRemoveItemFromStorage ( IEntity  item,
BaseInventoryStorageComponent  storage 
)

◆ CanReplaceItem()

proto external bool InventoryStorageManagerComponent.CanReplaceItem ( IEntity  item,
BaseInventoryStorageComponent  storage,
int  slotID 
)

Same as insert, only should allow replacing item at storage slot, slotID is required.

◆ CanSwapItemStorages()

proto external bool InventoryStorageManagerComponent.CanSwapItemStorages ( IEntity  itemA,
IEntity  itemB 
)

◆ Contains()

proto external bool InventoryStorageManagerComponent.Contains ( IEntity  item)

Returns true if item is in the storage, false otherwise.

◆ CountItem()

proto external int InventoryStorageManagerComponent.CountItem ( InventorySearchPredicate  predicate,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_DEPOSIT 
)

◆ FillInitialPrefabsToStore()

void InventoryStorageManagerComponent.FillInitialPrefabsToStore ( out array< ResourceName >  prefabsToSpawn)
protected

Override this method and fill in prefabsToSpawn array if you have some items you'd like to store in inventory at initialization time.

Implemented in SCR_ArsenalInventoryStorageManagerComponent.

◆ FillInitialStorages()

void InventoryStorageManagerComponent.FillInitialStorages ( out array< BaseInventoryStorageComponent storagesToAdd)
protected

Override this method and fill in storagesToAdd array if you have some storages you'd like to register to manager as owned at initialization time.

Implemented in SCR_TurretInventoryStorageManagerComponent, and SCR_VehicleInventoryStorageManagerComponent.

◆ FindItem()

proto external IEntity InventoryStorageManagerComponent.FindItem ( InventorySearchPredicate  predicate,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_DEPOSIT 
)

Find Item by providing InventorySearchPredicate object.

    class SCR_SomeCrazyPredicate: InventorySearchPredicate
    {
        void SCR_SomeCrazyPredicate()
        {
            QueryComponentTypes.Insert(SCR_ConsumableComponent);
            QueryComponentTypes.Insert(SCR_SomeOptionalComponent);
            QueryAttributeTypes.Insert(SCR_SomeOptionalAttribute);
        }

        override protected bool IsMatch(BaseInventoryStorageComponent storage, IEntity item, array<GenericComponent> queriedComponents, array<BaseItemAttributeData> queriedAttributes)
        {

at this point respective components and attributes are guaranteed to exist at respective type index SCR_ConsumableComponent optionalConsumable = SCR_ConsumableComponent.Cast(queriedComponents[0]); SCR_SomeOptionalComponent optionalComponent = SCR_SomeOtherComponent.Cast(queriedComponents[1]); SCR_SomeOptionalAttribute optionalAttribute = SCR_SomeOptionalAttribute.Cast(queriedAttributes[0]); return optionalConsumable.IsHealthType() && optionalComponent.ReadyToBeUsed() && optionalAttribute.m_bMyProperty; } } Somewhere down the road... IEntity FindCrazyItem() { If you plan on constantly using this predicate, consider storing it as member variable to save on additional allocations SCR_SomeCrazyPredicate predicate = new SCR_SomeCrazyPredicate(); IEntity crazyThing = inventoryStorageManagerComponent.FindItem(predicate, EStoragePurpose.PURPOSE_DEPOSIT); Print(crazyThing); return crazyThing; }

◆ FindItems()

proto external int InventoryStorageManagerComponent.FindItems ( out notnull array< IEntity >  foundItems,
InventorySearchPredicate  predicate,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_DEPOSIT 
)

◆ FindItemsWithComponents()

proto external int InventoryStorageManagerComponent.FindItemsWithComponents ( out notnull array< IEntity >  foundItems,
array< TypeName >  componentsQuery,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_DEPOSIT 
)

Find Items by specifying necessary component types (eg all Entities that contain all of the provided components), returns count of found items.

◆ FindItemWithComponents()

proto external IEntity InventoryStorageManagerComponent.FindItemWithComponents ( array< TypeName >  componentsQuery,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_DEPOSIT 
)

Find Item by specifying necessary component types (eg returns first Entity that contains all of the provided components) IEntity FindGrenadeInDeposit() { array<typename> components = {}; components.Insert(WeaponComponent); components.Insert(GrenadeMoveComponent); IEntity grenade = inventoryStorageManagerComponent.FindItemWithComponents(components, EStoragePurpose.PURPOSE_DEPOSIT); Print(grenade); return grenade; }.

◆ FindStorageForInsert()

proto external BaseInventoryStorageComponent InventoryStorageManagerComponent.FindStorageForInsert ( IEntity  item,
BaseInventoryStorageComponent  fromStorage,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY 
)

returns first storage with empty space from provided storage hierarchy for provided item and provided storage purpose

◆ FindStorageForItem()

proto external BaseInventoryStorageComponent InventoryStorageManagerComponent.FindStorageForItem ( IEntity  item,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY 
)

Will try to find suitable storage for item.

◆ FindStorageForResource()

proto external BaseInventoryStorageComponent InventoryStorageManagerComponent.FindStorageForResource ( ResourceName  resourceName,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY 
)

Will try to find suitable storage for resource.

◆ FindStorageForResourceInsert()

proto external BaseInventoryStorageComponent InventoryStorageManagerComponent.FindStorageForResourceInsert ( ResourceName  resourceName,
BaseInventoryStorageComponent  fromStorage,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY 
)

returns first storage with empty space from provided storage hierarchy for provided resource and provided storage purpose

◆ GetDepositItemCountByEntity()

proto external int InventoryStorageManagerComponent.GetDepositItemCountByEntity ( IEntity  verifier,
IEntity  entity 
)

Fast access to item count in inventory (returns only items that are stored in DEPOSIT storages)

◆ GetDepositItemCountByResource()

proto external int InventoryStorageManagerComponent.GetDepositItemCountByResource ( IEntity  verifier,
ResourceName  resourceName 
)

Fast access to item count in inventory (returns only items that are stored in DEPOSIT storages)

◆ GetGrenadesCount()

proto external int InventoryStorageManagerComponent.GetGrenadesCount ( )

◆ GetItems()

proto external int InventoryStorageManagerComponent.GetItems ( out notnull array< IEntity >  outItems)

Get all items from all managed storages.

◆ GetMagazineCountByMuzzle()

proto external int InventoryStorageManagerComponent.GetMagazineCountByMuzzle ( IEntity  verifier,
BaseMuzzleComponent  pMuzzle 
)

Find Items by specifying necessary component types (eg all Entities that contain all of the provided components), returns count of found items.

◆ GetMagazineCountByWeapon()

proto external int InventoryStorageManagerComponent.GetMagazineCountByWeapon ( BaseWeaponComponent  weapon)

Find Items by specifying necessary component types (eg all Entities that contain all of the provided components), returns count of found items.

◆ GetOwner()

proto external IEntity InventoryStorageManagerComponent.GetOwner ( )

◆ GetStorages()

proto external int InventoryStorageManagerComponent.GetStorages ( out notnull array< BaseInventoryStorageComponent outStorages,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY 
)

Get all managed storages.

◆ OnDelete()

void InventoryStorageManagerComponent.OnDelete ( IEntity  owner)

◆ OnItemAdded()

void InventoryStorageManagerComponent.OnItemAdded ( BaseInventoryStorageComponent  storageOwner,
IEntity  item 
)
protected

Callback when item is added (will be performed locally after server completed the Insert/Move operation)

Implemented in SCR_ArsenalInventoryStorageManagerComponent, SCR_InventoryStorageManagerComponent, and ScriptedInventoryStorageManagerComponent.

◆ OnItemRemoved()

void InventoryStorageManagerComponent.OnItemRemoved ( BaseInventoryStorageComponent  storageOwner,
IEntity  item 
)
protected

Callback when item is removed (will be performed locally after server completed the Remove/Move operation)

Implemented in SCR_ArsenalInventoryStorageManagerComponent, SCR_InventoryStorageManagerComponent, and ScriptedInventoryStorageManagerComponent.

◆ OnStorageAdded()

void InventoryStorageManagerComponent.OnStorageAdded ( BaseInventoryStorageComponent  storage)
protected

Will be called when new storage is registered at manager.

Implemented in SCR_InventoryStorageManagerComponent.

◆ OnStorageRemoved()

void InventoryStorageManagerComponent.OnStorageRemoved ( BaseInventoryStorageComponent  storage)
protected

Will be called when storage is unregistered from manager.

◆ ShouldForbidRemoveByInstigator()

bool InventoryStorageManagerComponent.ShouldForbidRemoveByInstigator ( InventoryStorageManagerComponent  instigatorManager,
BaseInventoryStorageComponent  fromStorage,
IEntity  item 
)
protected

Virtual method that allows verification of item removal as a result of move operation on inventory level.

Implemented in SCR_InventoryStorageManagerComponent.

◆ TryDeleteItem()

proto external bool InventoryStorageManagerComponent.TryDeleteItem ( IEntity  item,
InventoryOperationCallback  cb = null 
)

◆ TryInsertItem()

proto external bool InventoryStorageManagerComponent.TryInsertItem ( IEntity  item,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY,
InventoryOperationCallback  cb = null 
)

Will iterate over storages and try insert the item at first best match.

◆ TryInsertItemInStorage()

proto external bool InventoryStorageManagerComponent.TryInsertItemInStorage ( IEntity  item,
BaseInventoryStorageComponent  storage,
int  slotID = -1,
InventoryOperationCallback  cb = null 
)

Will try to insert item at storage. If slotID -1 will try to insert in any free storage.

◆ TryMoveItemToStorage()

proto external bool InventoryStorageManagerComponent.TryMoveItemToStorage ( IEntity  item,
BaseInventoryStorageComponent  to,
int  slotID = -1,
InventoryOperationCallback  cb = null 
)

Will try to move item from source storage to target storage.

◆ TryRemoveItemFromStorage()

proto external bool InventoryStorageManagerComponent.TryRemoveItemFromStorage ( IEntity  item,
BaseInventoryStorageComponent  storage,
InventoryOperationCallback  cb = null 
)

Will try to remove item from storage.

◆ TryReplaceItem()

proto external bool InventoryStorageManagerComponent.TryReplaceItem ( IEntity  item,
BaseInventoryStorageComponent  storage,
int  slotID,
InventoryOperationCallback  cb = null 
)

◆ TrySpawnPrefabToStorage()

proto external bool InventoryStorageManagerComponent.TrySpawnPrefabToStorage ( ResourceName  prefab,
BaseInventoryStorageComponent  storage = null,
int  slotID = -1,
EStoragePurpose  purpose = EStoragePurpose.PURPOSE_ANY,
InventoryOperationCallback  cb = null,
int  count = 1 
)

Spawn and insert into inventory if provided storage is null then most suitable storage would be chosen from owned storages.

◆ TrySwapItemStorages()

proto external bool InventoryStorageManagerComponent.TrySwapItemStorages ( IEntity  itemA,
IEntity  itemB,
InventoryOperationCallback  cb = null 
)

Will try to place itemA to itemB storage slot and itemB to itemA storage slot.

◆ ValidateStorageRequest()

proto external bool InventoryStorageManagerComponent.ValidateStorageRequest ( IEntity  storageOwner)

Validate that the storage is near the player to eliminate potentual message tampering.


The documentation for this interface was generated from the following file: