1037 {
1039
1040 if ( slot != NULL )
1041 {
1042 string item_type = item.GetType();
1043
1044 if ( slot.GetFertilityType() == "" || slot.GetFertilityType() == item_type )
1045 {
1046 slot.SetFertilityType(item_type);
1047
1048 float add_energy_to_slot =
GetGame().
ConfigGetFloat(
string.Format(
"cfgVehicles %1 Horticulture AddEnergyToSlot", item_type) );
1049 slot.m_FertilizerUsage =
GetGame().
ConfigGetFloat(
string.Format(
"cfgVehicles %1 Horticulture ConsumedQuantity", item_type) );
1050
1051 float coef = Math.Clamp( consumed_quantity / slot.m_FertilizerUsage, 0.0, 1.0 );
1052 add_energy_to_slot = coef * add_energy_to_slot;
1053
1054 slot.m_FertilizerQuantity += consumed_quantity;
1055 slot.m_Fertility += add_energy_to_slot;
1056
1057 if ( slot.GetFertilizerQuantity() >= slot.GetFertilizerQuantityMax() )
1058 {
1059 int slot_index = slot.GetSlotIndex();
1060
1061 if (slot_index > -1)
1062 {
1065
1067 }
1068 }
1069 }
1070 else
1071 {
1072 slot.SetFertilizerQuantity(0);
1073 slot.SetFertilityType("");
1075 }
1076 SetSynchDirty();
1077 }
1078 }
proto native float ConfigGetFloat(string path)
Get float value from config on path.
Slot GetSlotBySelection(string selection_component)
void UpdateSlotTexture(int slot_index)
This should be only called on server as the selections are synced to clients in C++.
proto native CGame GetGame()