Skip to content

Inventory ​

class in OpalScript

Holds named items with stack counts.

Properties ​

MemberDescription
Inventory.CapacityMaximum number of distinct item stacks. Adding past this emits the Full event.

Methods ​

MemberDescription
Inventory.CountRead the quantity stored under an item key.
Inventory.HasWhether any of this item is stored.
Inventory.HasAtLeastWhether at least the requested quantity is stored.
Inventory.IsEmptyWhether the inventory contains no items.
Inventory.IsFullWhether its capacity is reached.
Inventory.AddAdd items, respecting capacity, and return the committed quantity change.
Inventory.RemoveRemove items and return the committed quantity change.
Inventory.TransferToTransfer items to another inventory and return both committed results.
Inventory.ClearRemove all stored items.

Events ​

MemberDescription
Inventory.changedRaised after this component commits a state change, with the typed result.
Inventory.changeRefusedRaised when a requested state change is refused, with the typed result and reason.
Inventory.transferredRaised after an inventory transfer commits, with its InventoryTransfer result.
Inventory.transferRefusedRaised when an inventory transfer is refused, with its InventoryTransfer result and reason.

See also ​