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

◆ SplitItemToInventoryLocation()

void InventoryItem::SplitItemToInventoryLocation ( notnull InventoryLocation dst)
inlineprivate

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

1939 {
1940 if (!CanBeSplit())
1941 return;
1942
1943 float quantity = GetQuantity();
1944 float split_quantity_new = Math.Floor(quantity * 0.5);
1945
1946 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
1947
1948 if (new_item)
1949 {
1950 if (new_item.GetQuantityMax() < split_quantity_new)
1951 {
1952 split_quantity_new = new_item.GetQuantityMax();
1953 }
1954
1955 new_item.SetResultOfSplit(true);
1956 MiscGameplayFunctions.TransferItemProperties(this, new_item);
1957
1958 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
1959 {
1960 AddQuantity(-1);
1961 new_item.SetQuantity(1);
1962 }
1963 else
1964 {
1965 AddQuantity(-split_quantity_new);
1966 new_item.SetQuantity(split_quantity_new);
1967 }
1968 }
1969 }
eBleedingSourceType GetType()
Определения BleedingSource.c:63
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
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
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(), ECE_IN_INVENTORY, Math::Floor(), GetQuantity(), GetType(), ItemBase(), GameInventory::LocationCreateEntity(), RF_DEFAULT и ItemBase::SetQuantity().