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

◆ CreateItemBasePilesDispersed()

static array< ItemBase > CreateItemBasePilesDispersed ( string item_name,
vector starPos,
vector targetPos,
float radius,
float quantity,
float health,
Object ignoreObjectCollison )
staticprotected

creation method using raycast-dispersed positioning; ECE_TRACE not used as a result

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

517 {
518 array<ItemBase> item_piles;
519 float max_stack_size;
520 ItemBase pile;
521
522 item_piles = new array<ItemBase>;
523 max_stack_size = g_Game.ConfigGetInt("cfgVehicles " + item_name + " varStackMax");
524 if( max_stack_size < 1)
525 max_stack_size = g_Game.ConfigGetInt("cfgVehicles " + item_name + " varQuantityMax");
526 if( max_stack_size < 1)
527 max_stack_size = 1;
528
529 int full_piles_count = Math.Floor(quantity/max_stack_size);
530 int rest = quantity - (full_piles_count*max_stack_size);
531 vector randomizedPos;
532
533 for (int i = 0; i < full_piles_count; ++i)
534 {
535 randomizedPos = MiscGameplayFunctions.GetRandomizedPositionVerified(starPos,targetPos,radius,ignoreObjectCollison);
536 pile = ItemBase.Cast(GetGame().CreateObjectEx(item_name, randomizedPos, ECE_PLACE_ON_SURFACE));
537 pile.SetQuantity(max_stack_size);
538 pile.SetHealth(health);
539 item_piles.Insert(pile);
540 }
541
542 if (rest > 0)
543 {
544 randomizedPos = MiscGameplayFunctions.GetRandomizedPositionVerified(starPos,targetPos,radius,ignoreObjectCollison);
545 pile = ItemBase.Cast(GetGame().CreateObjectEx(item_name, randomizedPos, ECE_PLACE_ON_SURFACE));
546 pile.SetQuantity(rest);
547 pile.SetHealth(health);
548 item_piles.Insert(pile);
549 }
550 return item_piles;
551 }
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
DayZGame g_Game
Определения DayZGame.c:3868
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
Определения InventoryItem.c:731
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Определения EnConvert.c:106
proto native CGame GetGame()
static proto float Floor(float f)
Returns floor of value.

Перекрестные ссылки ECE_PLACE_ON_SURFACE, Math::Floor(), g_Game, GetGame() и ItemBase::SetQuantity().