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

◆ SetCEBasedQuantity()

void InventoryItem::SetCEBasedQuantity ( )
inlineprivate

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

824 {
825 if (GetEconomyProfile())
826 {
827 float q_max = GetEconomyProfile().GetQuantityMax();
828 if (q_max > 0)
829 {
830 float q_min = GetEconomyProfile().GetQuantityMin();
831 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
832
833 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
834 {
835 ComponentEnergyManager comp = GetCompEM();
836 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
837 {
838 comp.SetEnergy0To1(quantity_randomized);
839 }
840 }
841 else if (HasQuantity())
842 {
843 SetQuantityNormalized(quantity_randomized, false);
844 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
845 }
846
847 }
848 }
849 }
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1325
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:550
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1320
override bool HasQuantity()
Определения ItemBase.c:3503
override 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:3431
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9

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