sm.container.spend

Removes a quantity of a given item from a container.

Kind: Function

Environments: Game

Game

sm.container.spend( container, itemUuid, quantity, mustSpendAll, avoidSlot )

Open the full Game reference

Availability: Server only

Parameters:

Name Type Description
container Container The container.
itemUuid Uuid The uuid of the item.
quantity integer The number of items.
mustSpendAll (optional) boolean If true, only remove items if there are enough. If false, remove as many items as possible. Defaults to true. (Optional)
avoidSlot (optional) integer If the spending should try and avoid a specific inventory slot if the resource is available in inventory. (Optional)

Returns:

Type Description
integer The number of items successfully removed.