Inventory
class in OpalScript
Holds named items with stack counts.
Properties
| Member | Description |
|---|---|
| Inventory.Capacity | Maximum number of distinct item stacks. Adding past this emits the Full event. |
Methods
| Member | Description |
|---|---|
| Inventory.Count | Read the quantity stored under an item key. |
| Inventory.Has | Whether any of this item is stored. |
| Inventory.HasAtLeast | Whether at least the requested quantity is stored. |
| Inventory.IsEmpty | Whether the inventory contains no items. |
| Inventory.IsFull | Whether its capacity is reached. |
| Inventory.Add | Add items, respecting capacity, and return the committed quantity change. |
| Inventory.Remove | Remove items and return the committed quantity change. |
| Inventory.TransferTo | Transfer items to another inventory and return both committed results. |
| Inventory.Clear | Remove all stored items. |
Events
| Member | Description |
|---|---|
| Inventory.changed | Raised after this component commits a state change, with the typed result. |
| Inventory.changeRefused | Raised when a requested state change is refused, with the typed result and reason. |
| Inventory.transferred | Raised after an inventory transfer commits, with its InventoryTransfer result. |
| Inventory.transferRefused | Raised when an inventory transfer is refused, with its InventoryTransfer result and reason. |