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

◆ CombineItems()

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

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

2249 {
2250 if (!CanBeCombined(other_item, false))
2251 return;
2252
2253 if (!IsMagazine() && other_item)
2254 {
2255 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
2256 if (quantity_used != 0)
2257 {
2258 float hp1 = GetHealth01("","");
2259 float hp2 = other_item.GetHealth01("","");
2260 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
2261 hpResult = hpResult / (GetQuantity() + quantity_used);
2262
2263 hpResult *= GetMaxHealth();
2264 Math.Round(hpResult);
2265 SetHealth("", "Health", hpResult);
2266
2267 AddQuantity(quantity_used);
2268 other_item.AddQuantity(-quantity_used);
2269 }
2270 }
2271 OnCombine(other_item);
2272 }
override float GetQuantity()
Определения ItemBase.c:3386
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:2224
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 OnCombine(ItemBase other_item)
Определения ItemBase.c:2274
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения ItemBase.c:2142

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