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;
26 static const float LIQUID_BOILING_POINT = 150;
27 static const float LIQUID_VAPOR_QUANTITY = 2;
41 if (item_to_cook && item_to_cook.CanBeCooked())
44 item_to_cook.MakeSoundsOnClient(
true, pCookingMethod.param1);
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();
106 is_empty = cargo.GetItemCount() == 0;
109 for (
int i = 0; i < cargo.GetItemCount(); i++)
116 ProcessItemToCook(cooking_equipment, cooking_equipment, cookingMethodWithTime, stateFlags);
123 float cookingEquipmentTemp = cooking_equipment.GetTemperature();
126 if (cookingEquipmentTemp >= LIQUID_BOILING_POINT)
129 cooking_equipment.RemoveAllAgents();
131 if (cooking_equipment.GetQuantity() > 0)
134 cooking_equipment.AddQuantity(-LIQUID_VAPOR_QUANTITY);
139 bottle_base.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
142 FryingPan frying_pan = FryingPan.Cast(cooking_equipment);
143 if (frying_pan && !bottle_base)
146 frying_pan.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
155 if ( item_to_cook && item_to_cook.CanBeCookedOnStick() )
168 float food_temperature = item_to_cook.GetTemperature();
172 FoodStageType new_stage_type = item_to_cook.GetNextFoodStageType(cooking_method);
174 float food_min_temp = 0;
175 float food_time_to_cook = 0;
176 float food_max_temp = -1;
179 if (item_to_cook.CanChangeToNewStage(cooking_method))
182 next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage(new_stage_type,
null, item_to_cook.GetType());
184 food_min_temp = next_stage_cooking_properties.Get(eCookingPropertyIndices.MIN_TEMP);
185 food_time_to_cook = next_stage_cooking_properties.Get(eCookingPropertyIndices.COOK_TIME);
187 if (next_stage_cooking_properties.Count() > 2)
189 food_max_temp = next_stage_cooking_properties.Get(eCookingPropertyIndices.MAX_TEMP);
197 if (food_min_temp > 0 && food_temperature >= food_min_temp)
199 float new_cooking_time = item_to_cook.GetCookingTime() + COOKING_FOOD_TIME_INC_VALUE * cooking_time_coef;
200 item_to_cook.SetCookingTime(new_cooking_time);
203 if (item_to_cook.GetCookingTime() >= food_time_to_cook)
206 if (food_max_temp >= 0)
208 if (food_temperature > food_max_temp && item_to_cook.GetFoodStageType() !=
FoodStageType.BURNED)
215 item_to_cook.ChangeFoodStage(new_stage_type);
217 item_to_cook.RemoveAllAgentsExcept(
eAgents.BRAIN);
219 if (cooking_equipment)
227 float lardQuantity = lard.GetQuantity() - COOKING_LARD_DECREASE_COEF;
228 lardQuantity =
Math.Clamp(lardQuantity, 0, lard.GetQuantityMax());
229 lard.SetQuantity(lardQuantity);
245 item_to_cook.SetCookingTime(0);
258 float food_temperature = item_to_cook.GetTemperature();
263 float food_min_temp = 0;
264 float food_time_to_cook = 0;
265 float food_max_temp = -1;
266 bool is_done =
false;
267 bool is_burned =
false;
273 next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage( new_stage_type,
null, item_to_cook.GetType() );
275 food_min_temp = next_stage_cooking_properties.Get( eCookingPropertyIndices.MIN_TEMP );
276 food_time_to_cook = next_stage_cooking_properties.Get( eCookingPropertyIndices.COOK_TIME );
278 if ( next_stage_cooking_properties.Count() > 2 )
279 food_max_temp = next_stage_cooking_properties.Get( eCookingPropertyIndices.MAX_TEMP );
284 if (item_to_cook.GetInventory().IsAttachment())
292 if ( food_min_temp > 0 && food_temperature >= food_min_temp )
294 float new_cooking_time = item_to_cook.GetCookingTime() + cook_time_inc;
295 item_to_cook.SetCookingTime( new_cooking_time );
298 if ( item_to_cook.GetCookingTime() >= food_time_to_cook )
301 if ( food_max_temp >= 0 )
303 if ( food_temperature > food_max_temp && item_to_cook.GetFoodStageType() !=
FoodStageType.BURNED )
310 item_to_cook.ChangeFoodStage( new_stage_type );
311 item_to_cook.RemoveAllAgentsExcept(
eAgents.BRAIN);
316 item_to_cook.SetCookingTime( 0 );
328 float new_cook_time = item_to_cook.GetCookingTime() + cook_time_inc;
329 float drying_cook_time = FoodStage.GetCookingPropertyFromIndex(eCookingPropertyIndices.COOK_TIME,
FoodStageType.DRIED,
null, item_to_cook.GetType());
331 switch (item_to_cook.GetFoodStageType())
334 item_to_cook.SetCookingTime(new_cook_time);
336 if (item_to_cook.GetCookingTime() >= drying_cook_time)
339 item_to_cook.RemoveAllAgentsExcept(
eAgents.BRAIN);
340 item_to_cook.SetCookingTime(0);
344 item_to_cook.SetCookingTime(new_cook_time);
346 if (item_to_cook.GetCookingTime() >= drying_cook_time)
349 item_to_cook.RemoveAllAgents();
350 item_to_cook.SetCookingTime(0);
362 if (pItem.GetInventory())
364 CargoBase cargo = pItem.GetInventory().GetCargo();
367 for (
int i = 0; i < cargo.GetItemCount(); i++)
372 edible.MakeSoundsOnClient(
false);
382 edible.MakeSoundsOnClient(
false);
391 CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
394 for (
int i = 0; i < cargo.GetItemCount(); i++)
397 if (entity.Type() == item_type)
415 if (cooking_equipment.GetQuantity() > 0 && cooking_equipment.GetLiquidType() !=
LIQUID_GASOLINE)
444 switch (cooking_equipment.Type())
449 if (cooking_equipment.GetQuantity() > 0)
469 if (cooking_equipment.GetInventory().GetCargo().GetItemCount() > 0)
490 return food_on_stick;
495 FoodStageType food_stage_type = item_to_cook.GetNextFoodStageType( cooking_method );
496 return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.COOK_TIME, food_stage_type,
null, item_to_cook.GetType());
501 FoodStageType food_stage_type = item_to_cook.GetNextFoodStageType( cooking_method );
502 return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.MIN_TEMP, food_stage_type,
null, item_to_cook.GetType());
508 if ( cooked_item.GetTemperatureMax() >=
FireplaceBase.PARAM_ITEM_HEAT_MIN_TEMP )
510 float item_temperature = cooked_item.GetTemperature();
513 float actual_cooking_temp = DEFAULT_COOKING_TEMPERATURE;
514 if ( cooking_equipment )
516 actual_cooking_temp = cooking_equipment.GetTemperature();
520 if ( actual_cooking_temp > item_temperature )
522 item_temperature = actual_cooking_temp * 0.5;
523 item_temperature =
Math.Clamp( item_temperature, min_temperature, FOOD_MAX_COOKING_TEMPERATURE );
528 cooked_item.SetTemperature( item_temperature );
538 float quantity = pItem.GetQuantity() - pAmount;
539 quantity =
Math.Clamp(quantity, 0, pItem.GetQuantityMax());
540 pItem.SetQuantity(quantity);