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

◆ CreateItemBasePiles()

static array< ItemBase > CreateItemBasePiles ( string item_name,
vector ground_position,
float quantity,
float health,
bool floaty_spawn = false )
staticprotected

Spawns multiple piles of stackable ItemBase objects on ground (intended for generic use)

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

476 {
477 array<ItemBase> item_piles;
478 float max_stack_size;
479 ItemBase pile;
480
481 item_piles = new array<ItemBase>;
482 max_stack_size = g_Game.ConfigGetInt("cfgVehicles " + item_name + " varStackMax");
483 if( max_stack_size < 1)
484 max_stack_size = g_Game.ConfigGetInt("cfgVehicles " + item_name + " varQuantityMax");
485 if( max_stack_size < 1)
486 max_stack_size = 1;
487
488 int full_piles_count = Math.Floor(quantity/max_stack_size);
489 int rest = quantity - (full_piles_count*max_stack_size);
490
491 for (int i = 0; i < full_piles_count; ++i)
492 {
493 if (floaty_spawn)
494 pile = ItemBase.Cast(GetGame().CreateObjectEx(item_name, ground_position, ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH));
495 else
496 pile = ItemBase.Cast(GetGame().CreateObjectEx(item_name, ground_position, ECE_PLACE_ON_SURFACE));
497 pile.SetQuantity(max_stack_size);
498 pile.SetHealth(health);
499 item_piles.Insert(pile);
500 }
501
502 if (rest > 0)
503 {
504 if (floaty_spawn)
505 pile = ItemBase.Cast(GetGame().CreateObjectEx(item_name, ground_position, ECE_CREATEPHYSICS|ECE_UPDATEPATHGRAPH));
506 else
507 pile = ItemBase.Cast(GetGame().CreateObjectEx(item_name, ground_position, ECE_PLACE_ON_SURFACE));
508 pile.SetQuantity(rest);
509 pile.SetHealth(health);
510 item_piles.Insert(pile);
511 }
512 return item_piles;
513 }
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
const int ECE_UPDATEPATHGRAPH
Определения CentralEconomy.c:13
const int ECE_CREATEPHYSICS
Определения CentralEconomy.c:16
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.
proto native CGame GetGame()
static proto float Floor(float f)
Returns floor of value.

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