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

◆ ApplyAttributes()

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

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

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