44 item_to_cook.MakeSoundsOnClient(
true);
47 UpdateCookingState(item_to_cook, pCookingMethod.param1, cookingEquip, pCookingMethod.param2);
50 if (item_to_cook.IsFoodBoiled() || item_to_cook.IsFoodDried())
52 pStateFlags.param1 =
true;
55 else if (item_to_cook.IsFoodBaked() && item_to_cook.Type() != Lard)
57 pStateFlags.param1 =
true;
60 else if (item_to_cook.IsFoodBurned())
62 pStateFlags.param2 =
true;
83 if (cooking_equipment == null)
88 if (cooking_equipment.IsRuined())
98 if (cooking_time_coef != 1)
100 cookingMethodWithTime.param2 = cooking_time_coef;
103 CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
116 ProcessItemToCook(cooking_equipment, cooking_equipment, cookingMethodWithTime, stateFlags);
123 float cooking_equipment_temp = cooking_equipment.GetTemperature();
124 bool is_water_boiling;
130 cooking_equipment.RemoveAllAgents();
132 if (cooking_equipment.GetQuantity() > 0)
134 is_water_boiling =
true;
142 bottle_base.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
145 FryingPan frying_pan = FryingPan.Cast(cooking_equipment);
146 if (frying_pan && !bottle_base)
149 frying_pan.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
171 float food_temperature = item_to_cook.GetTemperature();
175 FoodStageType new_stage_type = item_to_cook.GetNextFoodStageType(cooking_method);
177 float food_min_temp = 0;
178 float food_time_to_cook = 0;
179 float food_max_temp = -1;
182 if (item_to_cook.CanChangeToNewStage(cooking_method))
185 next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage(new_stage_type, null, item_to_cook.GetType());
187 food_min_temp = next_stage_cooking_properties.Get(eCookingPropertyIndices.MIN_TEMP);
188 food_time_to_cook = next_stage_cooking_properties.Get(eCookingPropertyIndices.COOK_TIME);
190 if (next_stage_cooking_properties.Count() > 2)
192 food_max_temp = next_stage_cooking_properties.Get(eCookingPropertyIndices.MAX_TEMP);
200 if (food_min_temp > 0 && food_temperature >= food_min_temp)
203 item_to_cook.SetCookingTime(new_cooking_time);
206 if (item_to_cook.GetCookingTime() >= food_time_to_cook)
209 if (food_max_temp >= 0)
211 if (food_temperature > food_max_temp && item_to_cook.GetFoodStageType() !=
FoodStageType.BURNED)
218 item_to_cook.ChangeFoodStage(new_stage_type);
220 item_to_cook.RemoveAllAgentsExcept(
eAgents.BRAIN);
222 if (cooking_equipment)
231 lardQuantity =
Math.
Clamp(lardQuantity, 0, lard.GetQuantityMax());
232 lard.SetQuantity(lardQuantity);
248 item_to_cook.SetCookingTime(0);
261 float food_temperature = item_to_cook.GetTemperature();
266 float food_min_temp = 0;
267 float food_time_to_cook = 0;
268 float food_max_temp = -1;
269 bool is_done =
false;
270 bool is_burned =
false;
276 next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage( new_stage_type, null, item_to_cook.GetType() );
278 food_min_temp = next_stage_cooking_properties.Get( eCookingPropertyIndices.MIN_TEMP );
279 food_time_to_cook = next_stage_cooking_properties.Get( eCookingPropertyIndices.COOK_TIME );
281 if ( next_stage_cooking_properties.Count() > 2 )
282 food_max_temp = next_stage_cooking_properties.Get( eCookingPropertyIndices.MAX_TEMP );
287 if (item_to_cook.GetInventory().IsAttachment())
289 item_to_cook.MakeSoundsOnClient(
true);
295 if ( food_min_temp > 0 && food_temperature >= food_min_temp )
297 float new_cooking_time = item_to_cook.GetCookingTime() + cook_time_inc;
298 item_to_cook.SetCookingTime( new_cooking_time );
301 if ( item_to_cook.GetCookingTime() >= food_time_to_cook )
304 if ( food_max_temp >= 0 )
306 if ( food_temperature > food_max_temp && item_to_cook.GetFoodStageType() !=
FoodStageType.BURNED )
313 item_to_cook.ChangeFoodStage( new_stage_type );
314 item_to_cook.RemoveAllAgentsExcept(
eAgents.BRAIN);
319 item_to_cook.SetCookingTime( 0 );
331 float new_cook_time = item_to_cook.GetCookingTime() + cook_time_inc;
332 float drying_cook_time = FoodStage.GetCookingPropertyFromIndex(eCookingPropertyIndices.COOK_TIME,
FoodStageType.DRIED, null, item_to_cook.GetType());
334 switch (item_to_cook.GetFoodStageType())
337 item_to_cook.SetCookingTime(new_cook_time);
339 if (item_to_cook.GetCookingTime() >= drying_cook_time)
342 item_to_cook.RemoveAllAgentsExcept(
eAgents.BRAIN);
343 item_to_cook.SetCookingTime(0);
347 item_to_cook.SetCookingTime(new_cook_time);
349 if (item_to_cook.GetCookingTime() >= drying_cook_time)
352 item_to_cook.RemoveAllAgents();
353 item_to_cook.SetCookingTime(0);
365 if (pItem.GetInventory())
367 CargoBase cargo = pItem.GetInventory().GetCargo();
375 edible.MakeSoundsOnClient(
false);
385 edible.MakeSoundsOnClient(
false);
394 CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
400 if (entity.Type() == item_type)
418 if (cooking_equipment.GetQuantity() > 0 && cooking_equipment.GetLiquidType() !=
LIQUID_GASOLINE)
447 switch (cooking_equipment.Type())
452 if (cooking_equipment.GetQuantity() > 0)
487 return food_on_stick;
492 FoodStageType food_stage_type = item_to_cook.GetNextFoodStageType( cooking_method );
493 return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.COOK_TIME, food_stage_type, null, item_to_cook.GetType());
498 FoodStageType food_stage_type = item_to_cook.GetNextFoodStageType( cooking_method );
499 return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.MIN_TEMP, food_stage_type, null, item_to_cook.GetType());
505 if ( cooked_item.GetTemperatureMax() >=
FireplaceBase.PARAM_ITEM_HEAT_MIN_TEMP )
507 float item_temperature = cooked_item.GetTemperature();
511 if ( cooking_equipment )
513 actual_cooking_temp = cooking_equipment.GetTemperature();
517 if ( actual_cooking_temp > item_temperature )
519 item_temperature = actual_cooking_temp * 0.5;
525 cooked_item.SetTemperature( item_temperature );
535 float quantity = pItem.GetQuantity() - pAmount;
536 quantity =
Math.
Clamp(quantity, 0, pItem.GetQuantityMax());
537 pItem.SetQuantity(quantity);
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
protected ItemBase GetItemTypeFromCargo(typename item_type, ItemBase cooking_equipment)
Cooking data.
Edible_Base GetFoodOnStick(ItemBase stick_item)
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.
protected void AddTemperatureToItem(ItemBase cooked_item, ItemBase cooking_equipment, float min_temperature)
protected CookingMethodType GetCookingMethod(ItemBase cooking_equipment)
DEPREACTED.
static const float LIQUID_BOILING_POINT
float GetTimeToCook(Edible_Base item_to_cook, CookingMethodType cooking_method)
static const float PARAM_BURN_DAMAGE_COEF
protected int UpdateCookingState(Edible_Base item_to_cook, CookingMethodType cooking_method, ItemBase cooking_equipment, float cooking_time_coef)
static const float LIQUID_VAPOR_QUANTITY
void SmokeItem(Edible_Base item_to_cook, float cook_time_inc)
enum CookingMethodType TIME_WITH_SUPPORT_MATERIAL_COEF
static const float FOOD_MAX_COOKING_TEMPERATURE
protected void DecreaseCookedItemQuantity(notnull Edible_Base pItem, float pAmount=0.0)
int CookOnStick(Edible_Base item_to_cook, float cook_time_inc)
protected int UpdateCookingStateOnStick(Edible_Base item_to_cook, float cook_time_inc)
static const float TIME_WITHOUT_SUPPORT_MATERIAL_COEF
time modifier used when not using support material
COOKING_EQUIPMENT_FRYINGPAN
static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_LARD
how many units from quantity of item are removed at each stage when support material is NOT used
protected Param2< CookingMethodType, float > GetCookingMethodWithTimeOverride(ItemBase cooking_equipment)
protected void CookWithEquipment()
represents base for cargo storage for entities
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
override bool CanBeCookedOnStick()
override bool CanBeCooked()
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
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'.