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

◆ AddToStomach()

void AddToStomach ( string class_name,
float amount,
int food_stage = 0,
int agents = 0,
float temperature = 0 )
protected

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

402 {
404 return;
405
406 NutritionalProfile profile = Liquid.GetNutritionalProfileByName(class_name);
407 if (!profile)
408 profile = Edible_Base.GetNutritionalProfile(null, class_name, food_stage);
409
410 if (profile)
411 {
412 // sanity checks start
413 if (amount > ACCEPTABLE_QUANTITY_MAX || amount < 0)
414 amount = 0;
415
416 if (food_stage < 0 || food_stage > ACCEPTABLE_FOODSTAGE_MAX)
417 food_stage = FoodStageType.RAW;
418 // sanity checks end
419
420 agents = agents | profile.GetAgents();
421 bool found = false;
422 int count = m_StomachContents.Count();
423 for(int i = 0; i < count; i++)
424 {
425 StomachItem stomachItem = m_StomachContents.Get(i);
426 if (stomachItem.GetClassName() == class_name && stomachItem.m_Agents == agents)
427 {
428 if (profile.IsLiquid() || stomachItem.GetFoodStage() == food_stage)
429 {
430 float fraction = 1;
431 if (amount != 0)
432 fraction = (stomachItem.m_Amount + amount) / amount;
433
434 stomachItem.AddTemperature(temperature, fraction);
435 stomachItem.AddAmount(amount);
436 stomachItem.AddAgents(agents); //nutrition profile agents
437 found = true;
438 }
439 }
440 }
441
442 if (!found)
443 m_StomachContents.Insert(new StomachItem(class_name, amount, profile, food_stage, agents, temperature));
444
446 }
447 }
FoodStageType
Определения FoodStage.c:2
class OptionSelectorMultistate extends OptionSelector class_name
const int ACCEPTABLE_QUANTITY_MAX
Определения PlayerStomach.c:127
void UpdateStomachTemperature()
Определения PlayerStomach.c:270
const int ACCEPTABLE_FOODSTAGE_MAX
Определения PlayerStomach.c:128
ref array< ref StomachItem > m_StomachContents
Определения PlayerStomach.c:132
static int GetIDFromClassname(string name)
Определения PlayerStomach.c:202
static NutritionalProfile GetNutritionalProfile(ItemBase item, string classname="", int food_stage=0)
Определения Edible_Base.c:513
Определения Edible_Base.c:2
bool IsLiquid()
Определения NutritionalProfile.c:47
int GetAgents()
Определения NutritionalProfile.c:32
int GetFoodStage()
Определения PlayerStomach.c:38
string GetClassName()
Определения PlayerStomach.c:22
int m_Agents
Определения PlayerStomach.c:8
void AddTemperature(float temperature, float fraction)
Определения PlayerStomach.c:71
float m_Amount
Определения PlayerStomach.c:4
void AddAmount(float amount)
Определения PlayerStomach.c:55
void AddAgents(int agents)
Определения PlayerStomach.c:60
Определения PlayerStomach.c:2

Перекрестные ссылки ACCEPTABLE_FOODSTAGE_MAX, ACCEPTABLE_QUANTITY_MAX, StomachItem::AddAgents(), StomachItem::AddAmount(), StomachItem::AddTemperature(), class_name, NutritionalProfile::GetAgents(), StomachItem::GetClassName(), StomachItem::GetFoodStage(), GetIDFromClassname(), Edible_Base::GetNutritionalProfile(), NutritionalProfile::IsLiquid(), StomachItem::m_Agents, StomachItem::m_Amount, m_StomachContents и UpdateStomachTemperature().

Используется в OnStoreLoad().