15 static const float TIME_WITHOUT_SUPPORT_MATERIAL_COEF = 2.0;
17 static const float COOKING_FOOD_TIME_INC_VALUE = 2;
18 static const float COOKING_LARD_DECREASE_COEF = 25;
19 static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE = 25;
20 static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_LARD = 0;
22 static const float DEFAULT_COOKING_TEMPERATURE = 150;
23 static const float FOOD_MAX_COOKING_TEMPERATURE = 150;
24 static const float PARAM_BURN_DAMAGE_COEF = 0.05;
26 static const float LIQUID_BOILING_POINT = 150;
27 static const float LIQUID_VAPOR_QUANTITY = 2;
28 static const float SOLID_OVERHEAT_QUANTITY = 2;
30 static const float BURNING_WARNING_THRESHOLD = 0.75;
47 if (item_to_cook && item_to_cook.CanBeCooked())
50 UpdateCookingState(item_to_cook, pCookingMethod.param1, cookingEquip, pCookingMethod.param2);
55 pStateFlags.param1 |=
true;
58 else if (item_to_cook.
IsFoodBaked() && item_to_cook.Type() != Lard)
60 pStateFlags.param1 |=
true;
65 pStateFlags.param2 |=
true;
71 if (pItem != cookingEquip)
74 int liquidType = pItem.GetLiquidType();
75 bool handleLiquid = pItem.IsLiquidContainer() && liquidType !=
LIQUID_NONE;
76 bool isLiquiBoiling = handleLiquid && pItem.GetTemperature() >= Liquid.GetBoilThreshold(liquidType);
79 if (pItem.CanItemOverheat())
82 if (pItem.HasQuantity() && pItem.GetQuantityNormalized() > 0)
86 if (pItem.IsItemOverheated() || isLiquiBoiling)
87 pItem.AddQuantity(-LIQUID_VAPOR_QUANTITY,
false);
89 else if (pItem.IsItemOverheated())
91 pItem.AddQuantity(-SOLID_OVERHEAT_QUANTITY,
true);
94 else if (!pItem.IsCookware() && pItem.IsItemOverheated())
96 pItem.DecreaseHealth(PARAM_BURN_DAMAGE_COEF * 100);
101 if (!pItem.IsCookware())
102 pItem.DecreaseHealth(PARAM_BURN_DAMAGE_COEF * 100);
105 pItem.AddQuantity(-LIQUID_VAPOR_QUANTITY,
false);
110 pItem.RemoveAllAgentsExcept(
eAgents.HEAVYMETAL);
119 bool is_empty =
true;
122 if (cooking_equipment == null)
125 if (cooking_equipment.IsRuined())
131 if (cooking_time_coef != 1)
132 cookingMethodWithTime.param2 = cooking_time_coef;
135 ProcessItemToCook(cooking_equipment, cooking_equipment, cookingMethodWithTime, stateFlags);
138 if (cooking_equipment.IsCookware() && cooking_equipment.IsLiquidContainer())
141 if (cooking_time_coef != 1)
142 cookingMethodWithTime.param2 = cooking_time_coef;
146 CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
149 int count = cargo.GetItemCount();
150 is_empty = count == 0;
153 for (
int i = 0; i < count; i++)
160 int liquidType = cooking_equipment.GetLiquidType();
162 if (cooking_equipment.IsLiquidContainer() && liquidType !=
LIQUID_NONE)
164 if (cooking_equipment.GetTemperature() >= Liquid.GetBoilThreshold(liquidType))
167 cooking_equipment.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
171 cooking_equipment.RemoveAudioVisualsOnClient();
174 else if (cooking_equipment.IsCookware())
177 cooking_equipment.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
186 if ( item_to_cook && item_to_cook.CanBeCookedOnStick() )
199 float food_temperature = item_to_cook.GetTemperature();
205 float food_min_temp = 0;
206 float food_time_to_cook = 0;
212 next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage(new_stage_type, null, item_to_cook.GetType());
214 food_min_temp = next_stage_cooking_properties.Get(eCookingPropertyIndices.MIN_TEMP);
215 food_time_to_cook = next_stage_cooking_properties.Get(eCookingPropertyIndices.COOK_TIME);
222 if (item_to_cook.IsItemOverheated())
226 if (food_min_temp > 0 && food_temperature >= food_min_temp)
229 item_to_cook.MakeSoundsOnClient(
true,cooking_method);
231 float new_cooking_time = item_to_cook.
GetCookingTime() + COOKING_FOOD_TIME_INC_VALUE * cooking_time_coef;
242 if (cooking_equipment && cooking_equipment != item_to_cook)
250 float lardQuantity = lard.GetQuantity() - COOKING_LARD_DECREASE_COEF;
251 lardQuantity =
Math.Clamp(lardQuantity, 0, lard.GetQuantityMax());
252 lard.SetQuantity(lardQuantity);
276 item_to_cook.MakeSoundsOnClient(
false);
286 float food_temperature = item_to_cook.GetTemperature();
291 float food_min_temp = 0;
292 float food_time_to_cook = 0;
293 bool is_done =
false;
294 bool is_burned =
false;
300 next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage( new_stage_type, null, item_to_cook.GetType() );
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 );
306 if (item_to_cook.GetInventory().IsAttachment())
313 if (food_min_temp > 0 && food_temperature >= food_min_temp)
318 float new_cooking_time = item_to_cook.
GetCookingTime() + cook_time_inc;
338 item_to_cook.MakeSoundsOnClient(
false);
348 float new_cook_time = item_to_cook.
GetCookingTime() + cook_time_inc;
349 float drying_cook_time = FoodStage.GetCookingPropertyFromIndex(eCookingPropertyIndices.COOK_TIME,
FoodStageType.DRIED, null, item_to_cook.GetType());
350 float drying_cook_temp = FoodStage.GetCookingPropertyFromIndex(eCookingPropertyIndices.MIN_TEMP,
FoodStageType.DRIED, null, item_to_cook.GetType());
351 float itemTemp = item_to_cook.GetTemperature();
353 if (itemTemp >= drying_cook_temp)
386 CargoBase cargo = pItem.GetInventory().GetCargo();
389 for (
int i = 0; i < cargo.GetItemCount(); i++)
394 edible.MakeSoundsOnClient(
false);
403 edible.MakeSoundsOnClient(
false);
412 CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
415 for (
int i = 0; i < cargo.GetItemCount(); i++)
418 if (entity.Type() == item_type)
432 if (cooking_equipment.IsCookware())
434 if (cooking_equipment.GetQuantity() > 0)
451 if (cooking_equipment.GetInventory().GetCargo().GetItemCount() > 0)
458 else if (cooking_equipment.IsLiquidContainer() && cooking_equipment.GetQuantity() > 0 && cooking_equipment.GetLiquidType() !=
LIQUID_GASOLINE)
470 return food_on_stick;
476 return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.COOK_TIME, food_stage_type, null, item_to_cook.GetType());
482 return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.MIN_TEMP, food_stage_type, null, item_to_cook.GetType());
491 if (cooked_item == cooking_equipment)
494 if (cooked_item.CanHaveTemperature())
496 float itemTemp = cooked_item.GetTemperature();
501 if (cooking_equipment)
502 targetTemp = cooking_equipment.GetTemperature();
504 targetTemp = DEFAULT_COOKING_TEMPERATURE;
508 if (targetTemp != itemTemp || !cooked_item.IsFreezeThawProgressFinished())
510 float heatPermCoef = 1.0;
511 if (cooking_equipment)
512 heatPermCoef = cooking_equipment.GetHeatPermeabilityCoef();
513 heatPermCoef *= cooked_item.GetHeatPermeabilityCoef();
523 float quantity = pItem.GetQuantity() - pAmount;
524 quantity =
Math.Clamp(quantity, 0, pItem.GetQuantityMax());
525 pItem.SetQuantity(quantity);
537 if (cooking_equipment.GetQuantity() > 0 && cooking_equipment.GetLiquidType() !=
LIQUID_GASOLINE)
represents base for cargo storage for entities
FoodStageType GetFoodStageType()
FoodStageType GetNextFoodStageType(CookingMethodType cooking_method)
void SetCookingTime(float time)
void ChangeFoodStage(FoodStageType new_food_stage_type)
bool CanChangeToNewStage(CookingMethodType cooking_method)
override bool GetCookingTargetTemperature(out float temperature)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
float GetMinTempToCook(Edible_Base item_to_cook, CookingMethodType cooking_method)
COOKING_EQUIPMENT_CAULDRON
void TerminateCookingSounds(ItemBase pItem)
Edible_Base GetFoodOnStick(ItemBase stick_item)
void ProcessItemToCook(notnull ItemBase pItem, ItemBase cookingEquip, Param2< CookingMethodType, float > pCookingMethod, out Param2< bool, bool > pStateFlags)
Param2< CookingMethodType, float > GetCookingMethodWithTimeOverride(ItemBase cooking_equipment)
float GetTimeToCook(Edible_Base item_to_cook, CookingMethodType cooking_method)
CookingMethodType GetCookingMethod(ItemBase cooking_equipment)
DEPRECATED.
void SmokeItem(Edible_Base item_to_cook, float cook_time_inc)
COOKING_EQUIPMENT_POT
0..1, validly cooked item will pre-emptively start emitting burning sounds when this close to being b...
enum CookingMethodType TIME_WITH_SUPPORT_MATERIAL_COEF
void DecreaseCookedItemQuantity(notnull Edible_Base pItem, float pAmount=0.0)
int CookOnStick(Edible_Base item_to_cook, float cook_time_inc)
void SetCookingUpdateTime(float val)
int UpdateCookingState(Edible_Base item_to_cook, CookingMethodType cooking_method, ItemBase cooking_equipment, float cooking_time_coef)
int UpdateCookingStateOnStick(Edible_Base item_to_cook, float cook_time_inc)
COOKING_EQUIPMENT_FRYINGPAN
void AddTemperatureToItem(ItemBase cooked_item, ItemBase cooking_equipment, float min_temperature)
ItemBase GetItemTypeFromCargo(typename item_type, ItemBase cooking_equipment)
Cooking data.
proto native CGame GetGame()