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

◆ CreateMagazinePilesFromBullet()

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

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

613 {
614 array<Magazine> items;
615 items = new array<Magazine>;
616 float stack_size;
617 Magazine pile;
618 string item_name;
619 if (!g_Game.ConfigGetText("cfgAmmo " + bullet_type + " spawnPileType", item_name))
620 return items;
621
622 stack_size = g_Game.ConfigGetInt("cfgMagazines " + item_name + " count");
623
624 if (stack_size > 0)
625 {
626 int piles_count = Math.Floor(quantity/stack_size);
627 int rest = quantity - (piles_count*stack_size);
628
629 for (int i = 0; i < piles_count; ++i)
630 {
631 pile = Magazine.Cast(GetGame().CreateObjectEx(item_name, ground_position, ECE_PLACE_ON_SURFACE));
632 pile.ServerSetAmmoCount(stack_size);
633 items.Insert(pile);
634 }
635
636 if (rest > 0)
637 {
638 pile = Magazine.Cast(GetGame().CreateObjectEx(item_name, ground_position, ECE_PLACE_ON_SURFACE));
639 pile.ServerSetAmmoCount(rest);
640 items.Insert(pile);
641 }
642 }
643 return items;
644 }
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
DayZGame g_Game
Определения DayZGame.c:3868
Определения EnMath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
static proto float Floor(float f)
Returns floor of value.

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