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

◆ Fertilize()

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

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

430 {
431 Slot slot = GetSlotBySelection( selection_component );
432
433 if ( slot != NULL )
434 {
435 string item_type = item.GetType();
436
437 if ( slot.GetFertilityType() == "" || slot.GetFertilityType() == item_type )
438 {
439 slot.SetFertilityType(item_type);
440
441 float add_energy_to_slot = GetGame().ConfigGetFloat( string.Format("cfgVehicles %1 Horticulture AddEnergyToSlot", item_type) );
442 slot.m_FertilizerUsage = GetGame().ConfigGetFloat( string.Format("cfgVehicles %1 Horticulture ConsumedQuantity", item_type) );
443
444 float coef = Math.Clamp( consumed_quantity / slot.m_FertilizerUsage, 0.0, 1.0 );
445 add_energy_to_slot = coef * add_energy_to_slot;
446
447 slot.m_FertilizerQuantity += consumed_quantity;
448 slot.m_Fertility += add_energy_to_slot;
449
450 if ( slot.GetFertilizerQuantity() >= slot.GetFertilizerQuantityMax() )
451 {
452 int slot_index = slot.GetSlotIndex();
453
454 if (slot_index > -1)
455 {
456 UpdateSlotTexture( slot_index );
457 slot.SetFertilityState(eFertlityState.FERTILIZED);
458 // Set relevant bit
459 m_SlotFertilityState |= slot.GetFertilityState() << slot.GetSlotIndex();
460 }
461 }
462 }
463 else
464 {
465 slot.SetFertilizerQuantity(0);
466 slot.SetFertilityType("");
467 slot.SetFertilityState(eFertlityState.NONE);
468 }
469 SetSynchDirty();
470 }
471 }
eFertlityState
Определения Slot.c:2
proto native float ConfigGetFloat(string path)
Get float value from config on path.
Slot GetSlotBySelection(string selection_component)
Определения GardenBase.c:647
int m_SlotFertilityState
Определения GardenBase.c:26
void UpdateSlotTexture(int slot_index)
Определения GardenBase.c:512
proto native CGame GetGame()

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