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

◆ CombineItems()

void InventoryItem::CombineItems ( ItemBase other_item,
bool use_stack_max = true )
inlineprotected

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

2309 {
2310 if (!CanBeCombined(other_item, false))
2311 return;
2312
2313 if (!IsMagazine() && other_item)
2314 {
2315 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
2316 if (quantity_used != 0)
2317 {
2318 float hp1 = GetHealth01("","");
2319 float hp2 = other_item.GetHealth01("","");
2320 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
2321 hpResult = hpResult / (GetQuantity() + quantity_used);
2322
2323 hpResult *= GetMaxHealth();
2324 Math.Round(hpResult);
2325 SetHealth("", "Health", hpResult);
2326
2327 AddQuantity(quantity_used);
2328 other_item.AddQuantity(-quantity_used);
2329 }
2330 }
2331 OnCombine(other_item);
2332 }
override float GetQuantity()
Определения ItemBase.c:3508
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:2284
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:3413
void OnCombine(ItemBase other_item)
Определения ItemBase.c:2334
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения ItemBase.c:2202

Перекрестные ссылки AddQuantity(), ItemBase::CanBeCombined(), ComputeQuantityUsedEx(), GetQuantity(), ItemBase(), ItemBase::OnCombine() и Math::Round().