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

◆ ApplyAttributes()

static void PlayerSpawnHandler::ApplyAttributes ( ItemBase item,
PlayerSpawnAttributesData attributes )
inlinestaticprivate

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

317 {
318 if (!attributes)
319 return;
320
321 float health01 = Math.RandomFloatInclusive(attributes.healthMin,attributes.healthMax);
322 item.SetHealth01("","Health",health01);
323
324 float quantity01 = Math.RandomFloatInclusive(attributes.quantityMin,attributes.quantityMax);
325 if (item.IsMagazine())
326 {
327 Magazine mag = Magazine.Cast(item);
328 /*if (attributes.magazineAmmoOrdered && attributes.magazineAmmoOrdered.Count() > 0)
329 {
330 mag.ServerSetAmmoCount(0);
331 foreach (string bulletType : attributes.magazineAmmoOrdered)
332 {
333 mag.ServerStoreCartridge(health01,bulletType);
334 }
335 mag.SetSynchDirty();
336 }
337 else*/
338 {
339 int ammoQuantity = (int)Math.Lerp(0,mag.GetAmmoMax(),quantity01);
340 mag.ServerSetAmmoCount(ammoQuantity);
341 }
342 }
343 else //'varQuantityDestroyOnMin' quantity safeguard
344 {
345 float quantityAbsolute = Math.Lerp(item.GetQuantityMin(),item.GetQuantityMax(),quantity01);
346 quantityAbsolute = Math.Round(quantityAbsolute); //avoids weird floats
347 if (quantityAbsolute <= item.GetQuantityMin() && item.ConfigGetBool("varQuantityDestroyOnMin"))
348 quantityAbsolute++;
349 item.SetQuantity(quantityAbsolute);
350 }
351 }
Param3 int
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

Перекрестные ссылки Math::Lerp(), Math::RandomFloatInclusive(), Math::Round() и ItemBase::SetQuantity().

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