Loading...
Searching...
No Matches
CityBuilderCore.IItemReceiver Interface Reference

Detailed Description

building component that needs to be supplied with items by others(eg production buildings that get supplied by storage)

Inheritance diagram for CityBuilderCore.IItemReceiver:
CityBuilderCore.IBuildingTrait< IItemReceiver > CityBuilderCore.IItemOwner CityBuilderCore.IProductionComponent CityBuilderCore.IStorageComponent CityBuilderCore.ItemEfficiencyComponent CityBuilderTown.ItemConstructionComponent CityBuilderTown.TownConstructionComponent CityBuilderTown.TownMarketComponent CityBuilderCore.ProductionComponent CityBuilderCore.VariantProductionComponent CityBuilderCore.StorageComponent CityBuilderCore.ProductionWalkerComponent CityBuilderTown.TownProductionComponent CityBuilderCore.VariantProductionWalkerComponent CityBuilderCore.StorageWalkerComponent

Public Member Functions

IEnumerable< ItemGetReceiveItems ()
 returns the kinds of items the receiver needs
 
int GetReceiveCapacity (Item item)
 how much of the item the receiver can still fit
 
void ReserveCapacity (Item item, int quantity)
 reserves a capacity in the receiver so it is not filled up by someone else
 
void UnreserveCapacity (Item item, int quantity)
 releases capacity that was earlier reserved by ReserveCapacity(Item, int)
call before actually moving items into the receiver or if the delivery was somehow interrupted
 
int Receive (ItemStorage storage, Item item, int quantity)
 requests that a quantity of items is moved from the storage to the receiver
if the full amount does not fit the remaining quantity is returned
 

Properties

int Priority [get]
 can be used so certain receivers are preferred over others
for example construction sites or production may be more important that putting items into storage
 
- Properties inherited from CityBuilderCore.IBuildingTrait< IItemReceiver >
BuildingComponentReference< T > Reference [get, set]
 reference to the building trait, use when the building might be replaced and when the reference has to be saved
 
- Properties inherited from CityBuilderCore.IItemOwner
IItemContainer ItemContainer [get]
 holds and manages the items for the owner
 

Member Function Documentation

◆ GetReceiveCapacity()

int CityBuilderCore.IItemReceiver.GetReceiveCapacity ( Item item)

◆ GetReceiveItems()

◆ Receive()

int CityBuilderCore.IItemReceiver.Receive ( ItemStorage storage,
Item item,
int quantity )

requests that a quantity of items is moved from the storage to the receiver
if the full amount does not fit the remaining quantity is returned

Parameters
storagethe storage that items will be taken from
itemthe item to receive
quantitythe maximum quantity of items to receive
Returns
remaining quantity that did not fit

Implemented in CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, and CityBuilderTown.TownMarketComponent.

◆ ReserveCapacity()

void CityBuilderCore.IItemReceiver.ReserveCapacity ( Item item,
int quantity )

reserves a capacity in the receiver so it is not filled up by someone else

Parameters
itemthe item to be reserved
quantitythe quantity to reserve

Implemented in CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, and CityBuilderTown.TownMarketComponent.

◆ UnreserveCapacity()

void CityBuilderCore.IItemReceiver.UnreserveCapacity ( Item item,
int quantity )

releases capacity that was earlier reserved by ReserveCapacity(Item, int)
call before actually moving items into the receiver or if the delivery was somehow interrupted

Parameters
itemitem to unreserve
quantityquantity to unreserve

Implemented in CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, and CityBuilderTown.TownMarketComponent.

Property Documentation

◆ Priority

int CityBuilderCore.IItemReceiver.Priority
get

can be used so certain receivers are preferred over others
for example construction sites or production may be more important that putting items into storage

Implemented in CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, and CityBuilderTown.TownMarketComponent.