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

◆ CombineItems()

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

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

2283 {
2284 if (!CanBeCombined(other_item, false))
2285 return;
2286
2287 if (!IsMagazine() && other_item)
2288 {
2289 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
2290 if (quantity_used != 0)
2291 {
2292 float hp1 = GetHealth01("","");
2293 float hp2 = other_item.GetHealth01("","");
2294 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
2295 hpResult = hpResult / (GetQuantity() + quantity_used);
2296
2297 hpResult *= GetMaxHealth();
2298 Math.Round(hpResult);
2299 SetHealth("", "Health", hpResult);
2300
2301 AddQuantity(quantity_used);
2302 other_item.AddQuantity(-quantity_used);
2303 }
2304 }
2305 OnCombine(other_item);
2306 }
override float GetQuantity()
Определения ItemBase.c:3456
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:2258
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:3362
void OnCombine(ItemBase other_item)
Определения ItemBase.c:2308
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения ItemBase.c:2176

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