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

◆ SetCEBasedQuantity()

void SetCEBasedQuantity ( )
private

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

733 {
734 if (GetEconomyProfile())
735 {
736 float q_max = GetEconomyProfile().GetQuantityMax();
737 if (q_max > 0)
738 {
739 float q_min = GetEconomyProfile().GetQuantityMin();
740 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
741
742 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
743 {
744 ComponentEnergyManager comp = GetCompEM();
745 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
746 {
747 comp.SetEnergy0To1(quantity_randomized);
748 }
749 }
750 else if (HasQuantity())
751 {
752 SetQuantityNormalized(quantity_randomized, false);
753 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
754 }
755
756 }
757 }
758 }
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:3407
override bool HasQuantity()
Определения ItemBase.c:3481
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1312
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:537
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1307
Определения EnMath.c:7
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Определения EnMath.c:106

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

Используется в EEOnCECreate().