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

◆ FertilizeSlot()

void CAContinuousFertilizeGardenSlot::FertilizeSlot ( ItemBase item,
GardenBase gardenBase,
float consumedQuantity )
inlineprotected

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

114 {
115 if (m_Slot)
116 {
117 string itemType = item.GetType();
118 if (m_Slot.GetFertilityType() == "" || m_Slot.GetFertilityType() == itemType)
119 {
120 m_Slot.SetFertilityType(itemType);
121
122 float addEnergyToSlot = g_Game.ConfigGetFloat(string.Format("cfgVehicles %1 Horticulture AddEnergyToSlot", itemType));
123 m_Slot.m_FertilizerUsage = g_Game.ConfigGetFloat(string.Format("cfgVehicles %1 Horticulture ConsumedQuantity", itemType));
124
125 float coef = Math.Clamp(consumedQuantity / m_Slot.m_FertilizerUsage, 0.0, 1.0);
126 addEnergyToSlot = coef * addEnergyToSlot;
127
128 float fertilizerMax = m_Slot.GetFertilizerQuantityMax();
129 float newFertilizerQuantity = (m_Slot.m_FertilizerQuantity + consumedQuantity);
130 newFertilizerQuantity = Math.Clamp(newFertilizerQuantity, 0.0, fertilizerMax);
131 m_Slot.SetFertilizerQuantity(newFertilizerQuantity);
132
133 float newfertility = (m_Slot.m_Fertility + addEnergyToSlot);
134 float fertilityMax = m_Slot.GetFertilityMax();
135 newfertility = Math.Clamp(newfertility, 0.0, fertilityMax);
136 m_Slot.SetFertility(newfertility);
137 }
138 }
139 }
DayZGame g_Game
Определения DayZGame.c:3942

Перекрестные ссылки Math::Clamp(), g_Game и m_Slot.

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