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

◆ SplitItem()

void InventoryItem::SplitItem ( PlayerBase player)
inlineprivate

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

1972 {
1973 if (!CanBeSplit())
1974 return;
1975
1976 float quantity = GetQuantity();
1977 float split_quantity_new = Math.Floor(quantity / 2);
1978
1979 InventoryLocation invloc = new InventoryLocation;
1980 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
1981
1982 ItemBase new_item;
1983 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
1984
1985 if (new_item)
1986 {
1987 if (new_item.GetQuantityMax() < split_quantity_new)
1988 {
1989 split_quantity_new = new_item.GetQuantityMax();
1990 }
1991 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
1992 {
1993 AddQuantity(-1);
1994 new_item.SetQuantity(1);
1995 }
1996 else
1997 {
1998 AddQuantity(-split_quantity_new);
1999 new_item.SetQuantity(split_quantity_new);
2000 }
2001 }
2002 }
eBleedingSourceType GetType()
Определения BleedingSource.c:63
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
override float GetQuantity()
Определения ItemBase.c:3386
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:3292
void ItemBase()
Определения ItemBase.c:140
override bool CanBeSplit()
Определения ItemBase.c:1580
proto native bool IsValid()
verify current set inventory location
proto native int GetType()
returns type of InventoryLocation
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88

Перекрестные ссылки AddQuantity(), ItemBase::CanBeSplit(), Math::Floor(), GetQuantity(), GetType(), InventoryLocation::GetType(), InventoryLocation::IsValid(), ItemBase() и ItemBase::SetQuantity().