DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetNumberOfItems()

int GetNumberOfItems ( )
protected

Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.

См. определение в файле ItemBase.c строка 3550

3551 {
3552 int item_count = 0;
3553 ItemBase item;
3554
3555 GameInventory inventory = GetInventory();
3556 CargoBase cargo = inventory.GetCargo();
3557 if (cargo != NULL)
3558 {
3559 item_count = cargo.GetItemCount();
3560 }
3561
3562 int nAttachments = inventory.AttachmentCount();
3563 for (int i = 0; i < nAttachments; ++i)
3564 {
3565 Class.CastTo(item, inventory.GetAttachmentFromIndex(i));
3566 if (item)
3567 item_count += item.GetNumberOfItems();
3568 }
3569 return item_count;
3570 }
proto native int GetItemCount()
represents base for cargo storage for entities
Определения Cargo.c:7
Super root of all classes in Enforce script.
Определения EnScript.c:11
proto native EntityAI GetAttachmentFromIndex(int index)
proto native CargoBase GetCargo()
cargo
proto native int AttachmentCount()
Returns count of attachments attached to this item.
script counterpart to engine's class Inventory
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки GameInventory::AttachmentCount(), Class::CastTo(), GameInventory::GetAttachmentFromIndex(), GameInventory::GetCargo() и CargoBase::GetItemCount().

Используется в Barrel_ColorBase::CanDetachAttachment(), FireplaceBase::CanDetachAttachment(), ClothingBase::CanPutAsAttachment(), Barrel_ColorBase::CanPutInCargo(), Clothing::CanPutInCargo(), Clothing_Base::CanPutInCargoClothingConditions() и Barrel_ColorBase::CanPutIntoHands().