Loading...
Searching...
No Matches
CityBuilderCore.ItemStack Class Reference

Detailed Description

sub container for item 'slots' for storages in ItemStorageMode.Stacked
a stacked storage can define a number of stacks
each stack can only contain one type of item
makes for some nicely visualized storages

Classes

class  ItemStackData
 

Public Member Functions

int GetItemCapacity (Item item)
 
int GetItemCapacityRemaining (Item item)
 
bool HasItem (Item item)
 checks whether this stack is bound to a certain item, either because it contains a
 
int AddQuantity (Item item, int quantity)
 adds number of items to stack, returns remaining items not added
 
int RemoveQuantity (Item item, int quantity)
 removes items from the stack
 
void SetQuantity (int amount)
 
int ReserveCapacity (Item item, int amount)
 
int UnreserveCapacity (Item item, int amount)
 
ItemStackData GetData ()
 
void SetData (ItemStackData data)
 

Public Attributes

int UnitCapacity
 

Properties

ItemQuantity Items [get]
 
int ReservedCapacity [get]
 
bool HasItems [get]
 
float FillDegree [get]
 

Events

Action< ItemStackChanged
 

Member Function Documentation

◆ AddQuantity()

int CityBuilderCore.ItemStack.AddQuantity ( Item item,
int quantity )
inline

adds number of items to stack, returns remaining items not added

Parameters
itemthe type of item to add
quantityhow many of the item to add
Returns
the quantity that was not added because it does not fit

◆ HasItem()

bool CityBuilderCore.ItemStack.HasItem ( Item item)

checks whether this stack is bound to a certain item, either because it contains a

Parameters
item
Returns

◆ RemoveQuantity()

int CityBuilderCore.ItemStack.RemoveQuantity ( Item item,
int quantity )
inline

removes items from the stack

Parameters
itemthe type of item to remove
quantityhow much of the item to remove
Returns
the remaining quantity that was not removed