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

◆ Fertilize()

void ItemBase::Fertilize ( PlayerBase player,
ItemBase item,
float consumed_quantity,
string selection_component )
inlineprivate

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

1037 {
1038 Slot slot = GetSlotBySelection( selection_component );
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 {
1063 UpdateSlotTexture( slot_index );
1064 slot.SetFertilityState(eFertlityState.FERTILIZED);
1065 // Set relevant bit
1066 m_SlotFertilityState |= slot.GetFertilityState() << slot.GetSlotIndex();
1067 }
1068 }
1069 }
1070 else
1071 {
1072 slot.SetFertilizerQuantity(0);
1073 slot.SetFertilityType("");
1074 slot.SetFertilityState(eFertlityState.NONE);
1075 }
1076 SetSynchDirty();
1077 }
1078 }
eFertlityState
Определения Slot.c:2
proto native float ConfigGetFloat(string path)
Get float value from config on path.
Slot GetSlotBySelection(string selection_component)
Определения GardenBase.c:705
int m_SlotFertilityState
Определения GardenBase.c:27
void UpdateSlotTexture(int slot_index)
This should be only called on server as the selections are synced to clients in C++.
Определения GardenBase.c:563
proto native CGame GetGame()

Перекрестные ссылки Math::Clamp(), CGame::ConfigGetFloat(), GetGame(), GetSlotBySelection(), m_SlotFertilityState и UpdateSlotTexture().