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)
89 else if (pItem.IsItemOverheated())
94 else if (!pItem.IsCookware() && pItem.IsItemOverheated())
101 if (!pItem.IsCookware())
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();
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);
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)
242 if (cooking_equipment && cooking_equipment != item_to_cook)
251 lardQuantity =
Math.
Clamp(lardQuantity, 0, lard.GetQuantityMax());
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;
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();
412 CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
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();
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)
float GetMinTempToCook(Edible_Base item_to_cook, CookingMethodType cooking_method)
static const float COOKING_FOOD_TIME_INC_VALUE
time modifier used when using support material
COOKING_EQUIPMENT_CAULDRON
void TerminateCookingSounds(ItemBase pItem)
static const float COOKING_LARD_DECREASE_COEF
time increase when cooking a food
Edible_Base GetFoodOnStick(ItemBase stick_item)
static const float SOLID_OVERHEAT_QUANTITY
static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE
how many units from quantity of lard are remove at each stage
void ProcessItemToCook(notnull ItemBase pItem, ItemBase cookingEquip, Param2< CookingMethodType, float > pCookingMethod, out Param2< bool, bool > pStateFlags)
static const float DEFAULT_COOKING_TEMPERATURE
NOT USED.
Param2< CookingMethodType, float > GetCookingMethodWithTimeOverride(ItemBase cooking_equipment)
static const float LIQUID_BOILING_POINT
float GetTimeToCook(Edible_Base item_to_cook, CookingMethodType cooking_method)
static const float PARAM_BURN_DAMAGE_COEF
CookingMethodType GetCookingMethod(ItemBase cooking_equipment)
DEPRECATED.
static const float LIQUID_VAPOR_QUANTITY
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
static const float FOOD_MAX_COOKING_TEMPERATURE
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)
static const float BURNING_WARNING_THRESHOLD
static const float TIME_WITHOUT_SUPPORT_MATERIAL_COEF
time modifier used when not using support material
COOKING_EQUIPMENT_FRYINGPAN
void AddTemperatureToItem(ItemBase cooked_item, ItemBase cooking_equipment, float min_temperature)
static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_LARD
how many units from quantity of item are removed at each FoodStage change when support material is NO...
ItemBase GetItemTypeFromCargo(typename item_type, ItemBase cooking_equipment)
Cooking data.
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
void MakeSoundsOnClient(bool soundstate, CookingMethodType cookingMethod=CookingMethodType.NONE)
FoodStageType GetFoodStageType()
override bool CanBeCookedOnStick()
FoodStageType GetNextFoodStageType(CookingMethodType cooking_method)
void SetCookingTime(float time)
override bool CanBeCooked()
void ChangeFoodStage(FoodStageType new_food_stage_type)
bool CanChangeToNewStage(CookingMethodType cooking_method)
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override bool GetCookingTargetTemperature(out float temperature)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
const float TEMP_COEF_COOKING_DEFAULT
const int LIQUID_GASOLINE
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.