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

◆ CreateMagazinePilesFromBullet()

static array< Magazine > CreateMagazinePilesFromBullet ( string bullet_type,
vector ground_position,
float quantity,
float health )
staticprotected

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

641 {
642 array<Magazine> items;
643 items = new array<Magazine>;
644 float stack_size;
645 Magazine pile;
646 string item_name;
647 if (!g_Game.ConfigGetText("cfgAmmo " + bullet_type + " spawnPileType", item_name))
648 return items;
649
650 stack_size = g_Game.ConfigGetInt("cfgMagazines " + item_name + " count");
651
652 if (stack_size > 0)
653 {
654 int piles_count = Math.Floor(quantity/stack_size);
655 int rest = quantity - (piles_count*stack_size);
656
657 for (int i = 0; i < piles_count; ++i)
658 {
659 pile = Magazine.Cast(g_Game.CreateObjectEx(item_name, ground_position, ECE_PLACE_ON_SURFACE));
660 pile.ServerSetAmmoCount(stack_size);
661 items.Insert(pile);
662 }
663
664 if (rest > 0)
665 {
666 pile = Magazine.Cast(g_Game.CreateObjectEx(item_name, ground_position, ECE_PLACE_ON_SURFACE));
667 pile.ServerSetAmmoCount(rest);
668 items.Insert(pile);
669 }
670 }
671 return items;
672 }
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:38
DayZGame g_Game
Определения DayZGame.c:4074
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto float Floor(float f)
Returns floor of value.

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