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

◆ SetCEBasedQuantity()

void InventoryItem::SetCEBasedQuantity ( )
inlineprivate

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

814 {
815 if (GetEconomyProfile())
816 {
817 float q_max = GetEconomyProfile().GetQuantityMax();
818 if (q_max > 0)
819 {
820 float q_min = GetEconomyProfile().GetQuantityMin();
821 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
822
823 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
824 {
825 ComponentEnergyManager comp = GetCompEM();
826 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))//checking for a potential for energy, we need to check both values, as both are optional, only when both are set to 0, we know the item can't have energy
827 {
828 comp.SetEnergy0To1(quantity_randomized);
829 }
830 }
831 else if (HasQuantity())
832 {
833 SetQuantityNormalized(quantity_randomized, false);
834 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
835 }
836
837 }
838 }
839 }
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override bool HasQuantity()
Определения ItemBase.c:3381
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:3310
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9

Перекрестные ссылки COMP_TYPE_ENERGY_MANAGER, ComponentEnergyManager::GetEnergyAtSpawn(), ComponentEnergyManager::GetEnergyMaxPristine(), HasQuantity(), Math::RandomFloatInclusive(), ComponentEnergyManager::SetEnergy0To1() и SetQuantityNormalized().