class Item: Component

Indicates that an actor can be held in an Inventory.

stackable: fun(...any): Actor | false
stackCount: integer
stacklimit: unknown
__new(
    self: Item,
    options: {weight: number, volume: number, stackable: (boolean | fun(...any): Actor)?, stackLimit: number | nil}
)

Constructor for the Item component, see ItemOptions for available options.

stackLimit: number
stack(self: Item, actor: Actor)

Stacks an actor into this item. Updates the stackCount of both this item and the input item.

split(self: Item, count: integer): (split: Actor)

Splits the stack, constructing a new actor with the correct count and returning it. Returns its owner if count is 1 and the item is not stackable.

getWeight(self: Item): (weight: number)

Gets the total weight of this item taking into account its stackCount.

getVolume(self: Item): (volume: number)

Gets the total volume of this item taking into account its stackCount.