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

◆ CreateItemBasePilesEx()

static array< ItemBase > CreateItemBasePilesEx ( string itemName,
vector groundPosition,
float quantity,
float health,
bool floatySpawn = false,
bool throwAfterSpawn = false )
staticprotected

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

481 {
482 array<ItemBase> itemPiles;
483 float maxStackSize;
484 ItemBase pile;
485
486 itemPiles = new array<ItemBase>;
487 maxStackSize = g_Game.ConfigGetInt("cfgVehicles " + itemName + " varStackMax");
488 if( maxStackSize < 1)
489 maxStackSize = g_Game.ConfigGetInt("cfgVehicles " + itemName + " varQuantityMax");
490 if( maxStackSize < 1)
491 maxStackSize = 1;
492
493 int fullPilesCount = Math.Floor(quantity/maxStackSize);
494 int rest = quantity - (fullPilesCount * maxStackSize);
495
496 for (int i = 0; i < fullPilesCount; ++i)
497 {
498 if (floatySpawn)
499 {
500 pile = ItemBase.Cast(g_Game.CreateObjectEx(itemName, groundPosition, ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH));
501 }
502 else
503 {
504 pile = ItemBase.Cast(g_Game.CreateObjectEx(itemName, groundPosition, ECE_PLACE_ON_SURFACE));
505 }
506
507 pile.SetQuantity(maxStackSize);
508 pile.SetHealth(health);
509
510 if (throwAfterSpawn)
511 {
512 pile.ThrowPhysically(null, vector.Zero);
513 }
514
515 itemPiles.Insert(pile);
516 }
517
518 if (rest > 0)
519 {
520 if (floatySpawn)
521 {
522 pile = ItemBase.Cast(g_Game.CreateObjectEx(itemName, groundPosition, ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH));
523 }
524 else
525 {
526 pile = ItemBase.Cast(g_Game.CreateObjectEx(itemName, groundPosition, ECE_PLACE_ON_SURFACE));
527 }
528
529 pile.SetQuantity(rest);
530 pile.SetHealth(health);
531
532 if (throwAfterSpawn)
533 {
534 pile.ThrowPhysically(null, vector.Zero);
535 }
536
537 itemPiles.Insert(pile);
538 }
539
540 return itemPiles;
541 }
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:38
const int ECE_UPDATEPATHGRAPH
Определения CentralEconomy.c:13
const int ECE_CREATEPHYSICS
Определения CentralEconomy.c:17
DayZGame g_Game
Определения DayZGame.c:4074
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfBricks.c:64
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static const vector Zero
Определения EnConvert.c:123
Определения EnConvert.c:119
static proto float Floor(float f)
Returns floor of value.

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

Используется в CreateItemBasePiles().