114 {
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 =
GetGame().
ConfigGetFloat(
string.Format(
"cfgVehicles %1 Horticulture AddEnergyToSlot", 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 }
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto native CGame GetGame()