-
class Item:
Component¶ Indicates that an actor can be held in an
Inventory.-
stackable:
string¶ Other items with this identifier will stack with it.
-
stackCount:
number¶
-
stacklimit:
number¶
-
__new(
self:Item,
options: {weight:number, volume:number, stackable:string, stackLimit:number|nil, stackCount:number}
)¶ 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.
Other members:
Inherited from
Component:applyDiff(),checkRequirements(),clone(),diff(),getBase(),getRequirements(),owner,requirementsInherited from
Object:_serializationBlacklist,adopt(),assertType(),className,deepcopy(),deserialize(),extend(),instanceOf(),is(),isInstance(),mixin(),prettyprint(),serializationBlacklist,serialize()-
stackable: