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

◆ UpdateCookingStateOnStick()

int UpdateCookingStateOnStick ( Edible_Base item_to_cook,
float cook_time_inc )
protected

Change food stage to new, IF DIFFERENT

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

284 {
285 //food properties
286 float food_temperature = item_to_cook.GetTemperature();
287
288 //{min_temperature, time_to_cook, max_temperature (optional)}
289 //get next stage name - if next stage is not defined, next stage name will be empty "" and no cooking properties (food_min_temp, food_time_to_cook, food_max_temp) will be set
290 FoodStageType new_stage_type = item_to_cook.GetNextFoodStageType( CookingMethodType.BAKING );
291 float food_min_temp = 0;
292 float food_time_to_cook = 0;
293 bool is_done = false; // baked
294 bool is_burned = false; // burned
295
296 //Set next stage cooking properties if next stage possible
297 if ( item_to_cook.CanChangeToNewStage( CookingMethodType.BAKING ) )
298 {
299 array<float> next_stage_cooking_properties = new array<float>;
300 next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage( new_stage_type, null, item_to_cook.GetType() );
301
302 food_min_temp = next_stage_cooking_properties.Get( eCookingPropertyIndices.MIN_TEMP );
303 food_time_to_cook = next_stage_cooking_properties.Get( eCookingPropertyIndices.COOK_TIME );
304 }
305
306 if (item_to_cook.GetInventory().IsAttachment())
307 {
308 //add temperature
309 AddTemperatureToItem(item_to_cook, null, food_min_temp);
310 }
311
312 //add cooking time if the food can be cooked by this method
313 if (food_min_temp > 0 && food_temperature >= food_min_temp)
314 {
315 //refresh audio
316 item_to_cook.MakeSoundsOnClient(true, CookingMethodType.BAKING);
317
318 float new_cooking_time = item_to_cook.GetCookingTime() + cook_time_inc;
319 item_to_cook.SetCookingTime( new_cooking_time );
320
321 //progress to next stage
322 if (item_to_cook.GetCookingTime() >= food_time_to_cook)
323 {
325 if (item_to_cook.GetFoodStageType() != new_stage_type)
326 {
327 item_to_cook.ChangeFoodStage(new_stage_type);
328
330 }
331 //reset cooking time
332 item_to_cook.ResetCookingTime();
333 return 1;
334 }
335 }
336 else
337 {
338 item_to_cook.MakeSoundsOnClient(false);
339 }
340
341 return 0;
342 }
static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE
how many units from quantity of lard are remove at each stage
Определения Cooking.c:19
CookingMethodType
Определения Cooking.c:2
void DecreaseCookedItemQuantity(notnull Edible_Base pItem, float pAmount=0.0)
Определения Cooking.c:519
void AddTemperatureToItem(ItemBase cooked_item, ItemBase cooking_equipment, float min_temperature)
Определения Cooking.c:486
FoodStageType
Определения FoodStage.c:2
void MakeSoundsOnClient(bool soundstate, CookingMethodType cookingMethod=CookingMethodType.NONE)
Определения Edible_Base.c:215
FoodStageType GetFoodStageType()
Определения Edible_Base.c:531
FoodStageType GetNextFoodStageType(CookingMethodType cooking_method)
Определения Edible_Base.c:603
float GetCookingTime()
Определения Edible_Base.c:657
void SetCookingTime(float time)
Определения Edible_Base.c:662
void ResetCookingTime()
Определения Edible_Base.c:670
void ChangeFoodStage(FoodStageType new_food_stage_type)
Определения Edible_Base.c:598
bool CanChangeToNewStage(CookingMethodType cooking_method)
Определения Edible_Base.c:613
Result for an object found in CGame.IsBoxCollidingGeometryProxy.

Перекрестные ссылки AddTemperatureToItem(), Edible_Base::CanChangeToNewStage(), Edible_Base::ChangeFoodStage(), COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE, DecreaseCookedItemQuantity(), Edible_Base::GetCookingTime(), Edible_Base::GetFoodStageType(), Edible_Base::GetNextFoodStageType(), Edible_Base::MakeSoundsOnClient(), Edible_Base::ResetCookingTime() и Edible_Base::SetCookingTime().

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