18 if (
Class.
CastTo(targetGB, action_data.m_Target.GetObject()))
31 if (action_data.m_MainItem)
37 targetGB.GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selections);
39 for (
int s = 0; s < selections.Count(); s++)
47 string itemType = action_data.m_MainItem.GetType();
48 float consumedQuantity =
g_Game.ConfigGetFloat(
"cfgVehicles " + itemType +
" Horticulture ConsumedQuantity");
49 float actionLength =
g_Game.ConfigGetFloat(
"cfgVehicles " + itemType +
" Horticulture FertilizeLength");
50 if (actionLength == 0)
53 m_Slot.SetFertilizerQuantityMax(consumedQuantity);
59 float speedMultiplier = defaultTimeComplete / actionLength;
67 if (!action_data.m_Player)
81 string itemType = action_data.m_MainItem.GetType();
82 if (
m_Slot.GetFertilityType() !=
"" &&
m_Slot.GetFertilityType() != itemType)
84 m_Slot.SetFertilityType(itemType);
90 if (!
Class.
CastTo(gardenBase, action_data.m_Target.GetObject()))
117 string itemType = item.GetType();
118 if (
m_Slot.GetFertilityType() ==
"" ||
m_Slot.GetFertilityType() == itemType)
120 m_Slot.SetFertilityType(itemType);
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));
125 float coef =
Math.
Clamp(consumedQuantity /
m_Slot.m_FertilizerUsage, 0.0, 1.0);
126 addEnergyToSlot = coef * addEnergyToSlot;
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);
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);