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

◆ CombineItems()

void CombineItems ( ItemBase other_item,
bool use_stack_max = true )
protected

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

2244 {
2245 if (!CanBeCombined(other_item, false))
2246 return;
2247
2248 if (!IsMagazine() && other_item)
2249 {
2250 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
2251 if (quantity_used != 0)
2252 {
2253 float hp1 = GetHealth01("","");
2254 float hp2 = other_item.GetHealth01("","");
2255 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
2256 hpResult = hpResult / (GetQuantity() + quantity_used);
2257
2258 hpResult *= GetMaxHealth();
2259 Math.Round(hpResult);
2260 SetHealth("", "Health", hpResult);
2261
2262 AddQuantity(quantity_used);
2263 other_item.AddQuantity(-quantity_used);
2264 }
2265 }
2266 OnCombine(other_item);
2267 }
void OnCombine(ItemBase other_item)
Определения ItemBase.c:2269
override float GetQuantity()
Определения ItemBase.c:3486
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:2219
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения ItemBase.c:2137
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:3389
Определения EnMath.c:7
static proto float Round(float f)
Returns mathematical round of value.

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

Используется в CombineItemsClient() и CombineItemsEx().