cooking.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. enum CookingMethodType
  2. {
  3. NONE = 0, //no cooking method available
  4. BAKING = 1,
  5. BOILING = 2,
  6. DRYING = 3,
  7. TIME = 4,
  8. COUNT
  9. }
  10. class Cooking
  11. {
  12. static const float TIME_WITH_SUPPORT_MATERIAL_COEF = 1.0; //! time modifier used when not using support material
  13. static const float TIME_WITHOUT_SUPPORT_MATERIAL_COEF = 2.0; //! time modifier used when using support material
  14. static const float COOKING_FOOD_TIME_INC_VALUE = 2; //! time increase when cooking a food
  15. static const float COOKING_LARD_DECREASE_COEF = 25; //! how many units from quantity of lard are remove at each stage
  16. static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE = 25; //! how many units from quantity of item are removed at each FoodStage change when support material is NOT used
  17. static const float COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_LARD = 0; //! NOT USED.
  18. static const float DEFAULT_COOKING_TEMPERATURE = 150; //default temperature for cooking (e.g. cooking on stick)
  19. static const float FOOD_MAX_COOKING_TEMPERATURE = 150; //
  20. static const float PARAM_BURN_DAMAGE_COEF = 0.05; //value for calculating damage on items located in fireplace CargoGrid
  21. static const float LIQUID_BOILING_POINT = 150; //default boiling point for liquids, overriden by 'liquidBoilingThreshold' in cfgLiquidDefinitions
  22. static const float LIQUID_VAPOR_QUANTITY = 2; //vaporization quantity loss
  23. static const float SOLID_OVERHEAT_QUANTITY = 2; //solid overheat quantity loss
  24. static const float BURNING_WARNING_THRESHOLD = 0.75; //! 0..1, validly cooked item will pre-emptively start emitting burning sounds when this close to being burned
  25. typename COOKING_EQUIPMENT_POT = Pot;
  26. typename COOKING_EQUIPMENT_FRYINGPAN = FryingPan;
  27. typename COOKING_EQUIPMENT_CAULDRON = Cauldron;
  28. typename COOKING_INGREDIENT_LARD = Lard;
  29. protected float m_UpdateTime = 1; //set by the item/system using cooking
  30. void SetCookingUpdateTime(float val)
  31. {
  32. m_UpdateTime = val;
  33. }
  34. void ProcessItemToCook(notnull ItemBase pItem, ItemBase cookingEquip, Param2<CookingMethodType, float> pCookingMethod, out Param2<bool, bool> pStateFlags)
  35. {
  36. Edible_Base item_to_cook = Edible_Base.Cast(pItem);
  37. if (item_to_cook && item_to_cook.CanBeCooked())
  38. {
  39. //! update food
  40. UpdateCookingState(item_to_cook, pCookingMethod.param1, cookingEquip, pCookingMethod.param2);
  41. //check for done state for boiling and drying
  42. if (item_to_cook.IsFoodBoiled() || item_to_cook.IsFoodDried())
  43. {
  44. pStateFlags.param1 |= true;
  45. }
  46. //! check for done state from baking (exclude Lard from baked items)
  47. else if (item_to_cook.IsFoodBaked() && item_to_cook.Type() != Lard)
  48. {
  49. pStateFlags.param1 |= true;
  50. }
  51. //! check for burned state
  52. else if (item_to_cook.IsFoodBurned())
  53. {
  54. pStateFlags.param2 |= true;
  55. }
  56. }
  57. else
  58. {
  59. //add temperature to item
  60. if (pItem != cookingEquip) //1st order item already handled by the fireplace directly!
  61. AddTemperatureToItem(pItem, null, 0);
  62. int liquidType = pItem.GetLiquidType();
  63. bool handleLiquid = pItem.IsLiquidContainer() && liquidType != LIQUID_NONE;
  64. bool isLiquiBoiling = handleLiquid && pItem.GetTemperature() >= Liquid.GetBoilThreshold(liquidType);
  65. //handle items that can actually overheat
  66. if (pItem.CanItemOverheat())
  67. {
  68. //handle qty first
  69. if (pItem.HasQuantity() && pItem.GetQuantityNormalized() > 0)
  70. {
  71. if (handleLiquid)
  72. {
  73. if (pItem.IsItemOverheated() || isLiquiBoiling) //overheat causes qty loss here!
  74. pItem.AddQuantity(-LIQUID_VAPOR_QUANTITY,false);
  75. }
  76. else if (pItem.IsItemOverheated())
  77. {
  78. pItem.AddQuantity(-SOLID_OVERHEAT_QUANTITY,true);
  79. }
  80. }//next handle damage
  81. else if (!pItem.IsCookware() && pItem.IsItemOverheated()) //cookware already damaged by fireplace, skipping
  82. {
  83. pItem.DecreaseHealth(PARAM_BURN_DAMAGE_COEF * 100);
  84. }
  85. }
  86. else
  87. {
  88. if (!pItem.IsCookware()) //cookware already damaged by fireplace, skipping
  89. pItem.DecreaseHealth(PARAM_BURN_DAMAGE_COEF * 100);
  90. if (isLiquiBoiling)
  91. pItem.AddQuantity(-LIQUID_VAPOR_QUANTITY,false);
  92. }
  93. //last handle agents
  94. if (isLiquiBoiling)
  95. pItem.RemoveAllAgentsExcept(eAgents.HEAVYMETAL);
  96. }
  97. }
  98. //COOKING PROCESS
  99. //--- Cooking with equipment (pot)
  100. //Returns 1 if the item changed its cooking stage, 0 if not
  101. int CookWithEquipment(ItemBase cooking_equipment, float cooking_time_coef = 1)
  102. {
  103. bool is_empty = true;
  104. //check cooking conditions
  105. if (cooking_equipment == null)
  106. return 0;
  107. if (cooking_equipment.IsRuined())
  108. return 0;
  109. //manage items in cooking equipment
  110. Param2<bool, bool> stateFlags = new Param2<bool, bool>(false, false); // 1st - done; 2nd - burned
  111. Param2<CookingMethodType, float> cookingMethodWithTime = GetCookingMethodWithTimeOverride(cooking_equipment);
  112. if (cooking_time_coef != 1)
  113. cookingMethodWithTime.param2 = cooking_time_coef;
  114. //handle the cooking equipment/direct cooking first
  115. ProcessItemToCook(cooking_equipment, cooking_equipment, cookingMethodWithTime, stateFlags);
  116. //cooking method may have changed due to liquid evaporating, refresh..
  117. if (cooking_equipment.IsCookware() && cooking_equipment.IsLiquidContainer())
  118. {
  119. cookingMethodWithTime = GetCookingMethodWithTimeOverride(cooking_equipment);
  120. if (cooking_time_coef != 1)
  121. cookingMethodWithTime.param2 = cooking_time_coef;
  122. }
  123. //handle the cooking inside of a container last
  124. CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
  125. if (cargo)
  126. {
  127. int count = cargo.GetItemCount();
  128. is_empty = count == 0;
  129. //process items
  130. for (int i = 0; i < count; i++)
  131. {
  132. ProcessItemToCook(ItemBase.Cast(cargo.GetItem(i)), cooking_equipment, cookingMethodWithTime, stateFlags);
  133. }
  134. }
  135. //manage equipment EFFECTS
  136. int liquidType = cooking_equipment.GetLiquidType();
  137. //handle liquid boiling EFFECTS
  138. if (cooking_equipment.IsLiquidContainer() && liquidType != LIQUID_NONE)
  139. {
  140. if (cooking_equipment.GetTemperature() >= Liquid.GetBoilThreshold(liquidType))
  141. {
  142. //handle boiling audiovisuals for any liquid container
  143. cooking_equipment.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
  144. }
  145. else
  146. {
  147. cooking_equipment.RemoveAudioVisualsOnClient();
  148. }
  149. }
  150. else if (cooking_equipment.IsCookware())
  151. {
  152. //handle non-boiling audiovisuals for cookware only
  153. cooking_equipment.RefreshAudioVisualsOnClient(cookingMethodWithTime.param1, stateFlags.param1, is_empty, stateFlags.param2);
  154. }
  155. return 1;
  156. }
  157. //Returns 1 if the item changed its cooking stage, 0 if not
  158. int CookOnStick( Edible_Base item_to_cook, float cook_time_inc )
  159. {
  160. if ( item_to_cook && item_to_cook.CanBeCookedOnStick() )
  161. {
  162. //update food
  163. return UpdateCookingStateOnStick( item_to_cook, cook_time_inc );
  164. }
  165. return 0;
  166. }
  167. //Returns 1 if the item changed its cooking stage, 0 if not
  168. protected int UpdateCookingState(Edible_Base item_to_cook, CookingMethodType cooking_method, ItemBase cooking_equipment, float cooking_time_coef)
  169. {
  170. //food properties
  171. float food_temperature = item_to_cook.GetTemperature();
  172. //{min_temperature, time_to_cook, max_temperature (optional)}
  173. //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
  174. FoodStageType new_stage_type = item_to_cook.GetNextFoodStageType(cooking_method);
  175. float food_min_temp = 0;
  176. float food_time_to_cook = 0;
  177. //Set next stage cooking properties if next stage possible
  178. if (item_to_cook.CanChangeToNewStage(cooking_method)) // new_stage_type != NONE
  179. {
  180. array<float> next_stage_cooking_properties = new array<float>();
  181. next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage(new_stage_type, null, item_to_cook.GetType());
  182. food_min_temp = next_stage_cooking_properties.Get(eCookingPropertyIndices.MIN_TEMP); //checked after temperature is changed
  183. food_time_to_cook = next_stage_cooking_properties.Get(eCookingPropertyIndices.COOK_TIME);
  184. }
  185. //add temperature
  186. AddTemperatureToItem(item_to_cook, cooking_equipment, food_min_temp);
  187. //decrease qty of burned items (or cookable items that can't be burned)
  188. if (item_to_cook.IsItemOverheated())
  189. DecreaseCookedItemQuantity(item_to_cook,COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE);
  190. //add cooking time if the food can be cooked by this method
  191. if (food_min_temp > 0 && food_temperature >= food_min_temp)
  192. {
  193. //! enable cooking SoundEvent
  194. item_to_cook.MakeSoundsOnClient(true,cooking_method);
  195. float new_cooking_time = item_to_cook.GetCookingTime() + COOKING_FOOD_TIME_INC_VALUE * cooking_time_coef;
  196. item_to_cook.SetCookingTime(new_cooking_time);
  197. //progress to next stage
  198. if (item_to_cook.GetCookingTime() >= food_time_to_cook)
  199. {
  200. //! Change food stage to new, IF DIFFERENT
  201. if (item_to_cook.GetFoodStageType() != new_stage_type)
  202. {
  203. item_to_cook.ChangeFoodStage(new_stage_type);
  204. if (cooking_equipment && cooking_equipment != item_to_cook)
  205. {
  206. if (cooking_method == CookingMethodType.BAKING)
  207. {
  208. ItemBase lard = GetItemTypeFromCargo(COOKING_INGREDIENT_LARD, cooking_equipment);
  209. if (lard)
  210. {
  211. //decrease lard quantity
  212. float lardQuantity = lard.GetQuantity() - COOKING_LARD_DECREASE_COEF;
  213. lardQuantity = Math.Clamp(lardQuantity, 0, lard.GetQuantityMax());
  214. lard.SetQuantity(lardQuantity);
  215. }
  216. else
  217. {
  218. //! any foodstage without lard
  219. DecreaseCookedItemQuantity(item_to_cook, COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE);
  220. }
  221. }
  222. }
  223. else
  224. {
  225. //! any foodstage without lard
  226. DecreaseCookedItemQuantity(item_to_cook, COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE);
  227. }
  228. }
  229. //reset cooking time
  230. item_to_cook.ResetCookingTime();
  231. return 1;
  232. }
  233. }
  234. else
  235. {
  236. item_to_cook.MakeSoundsOnClient(false);
  237. }
  238. return 0;
  239. }
  240. //Returns 1 if the item changed its cooking stage, 0 if not
  241. protected int UpdateCookingStateOnStick( Edible_Base item_to_cook, float cook_time_inc )
  242. {
  243. //food properties
  244. float food_temperature = item_to_cook.GetTemperature();
  245. //{min_temperature, time_to_cook, max_temperature (optional)}
  246. //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
  247. FoodStageType new_stage_type = item_to_cook.GetNextFoodStageType( CookingMethodType.BAKING );
  248. float food_min_temp = 0;
  249. float food_time_to_cook = 0;
  250. bool is_done = false; // baked
  251. bool is_burned = false; // burned
  252. //Set next stage cooking properties if next stage possible
  253. if ( item_to_cook.CanChangeToNewStage( CookingMethodType.BAKING ) )
  254. {
  255. array<float> next_stage_cooking_properties = new array<float>;
  256. next_stage_cooking_properties = FoodStage.GetAllCookingPropertiesForStage( new_stage_type, null, item_to_cook.GetType() );
  257. food_min_temp = next_stage_cooking_properties.Get( eCookingPropertyIndices.MIN_TEMP );
  258. food_time_to_cook = next_stage_cooking_properties.Get( eCookingPropertyIndices.COOK_TIME );
  259. }
  260. if (item_to_cook.GetInventory().IsAttachment())
  261. {
  262. //add temperature
  263. AddTemperatureToItem(item_to_cook, null, food_min_temp);
  264. }
  265. //add cooking time if the food can be cooked by this method
  266. if (food_min_temp > 0 && food_temperature >= food_min_temp)
  267. {
  268. //refresh audio
  269. item_to_cook.MakeSoundsOnClient(true, CookingMethodType.BAKING);
  270. float new_cooking_time = item_to_cook.GetCookingTime() + cook_time_inc;
  271. item_to_cook.SetCookingTime( new_cooking_time );
  272. //progress to next stage
  273. if (item_to_cook.GetCookingTime() >= food_time_to_cook)
  274. {
  275. //! Change food stage to new, IF DIFFERENT
  276. if (item_to_cook.GetFoodStageType() != new_stage_type)
  277. {
  278. item_to_cook.ChangeFoodStage(new_stage_type);
  279. DecreaseCookedItemQuantity(item_to_cook, COOKING_FOOD_QUANTITY_DECREASE_AMOUNT_NONE);
  280. }
  281. //reset cooking time
  282. item_to_cook.ResetCookingTime();
  283. return 1;
  284. }
  285. }
  286. else
  287. {
  288. item_to_cook.MakeSoundsOnClient(false);
  289. }
  290. return 0;
  291. }
  292. void SmokeItem(Edible_Base item_to_cook, float cook_time_inc)
  293. {
  294. if (item_to_cook)
  295. {
  296. float new_cook_time = item_to_cook.GetCookingTime() + cook_time_inc;
  297. float drying_cook_time = FoodStage.GetCookingPropertyFromIndex(eCookingPropertyIndices.COOK_TIME, FoodStageType.DRIED, null, item_to_cook.GetType());
  298. float drying_cook_temp = FoodStage.GetCookingPropertyFromIndex(eCookingPropertyIndices.MIN_TEMP, FoodStageType.DRIED, null, item_to_cook.GetType());
  299. float itemTemp = item_to_cook.GetTemperature();
  300. if (itemTemp >= drying_cook_temp)
  301. {
  302. switch (item_to_cook.GetFoodStageType())
  303. {
  304. case FoodStageType.RAW:
  305. item_to_cook.SetCookingTime(new_cook_time);
  306. if (item_to_cook.GetCookingTime() >= drying_cook_time)
  307. {
  308. item_to_cook.ChangeFoodStage(FoodStageType.DRIED);
  309. item_to_cook.ResetCookingTime();
  310. }
  311. break;
  312. default:
  313. item_to_cook.SetCookingTime(new_cook_time);
  314. if (item_to_cook.GetCookingTime() >= drying_cook_time)
  315. {
  316. item_to_cook.ChangeFoodStage(FoodStageType.BURNED);
  317. item_to_cook.ResetCookingTime();
  318. }
  319. break;
  320. }
  321. }
  322. }
  323. }
  324. void TerminateCookingSounds(ItemBase pItem)
  325. {
  326. Edible_Base edible;
  327. if (pItem)
  328. {
  329. CargoBase cargo = pItem.GetInventory().GetCargo();
  330. if (cargo) // cookware
  331. {
  332. for (int i = 0; i < cargo.GetItemCount(); i++)
  333. {
  334. edible = Edible_Base.Cast(cargo.GetItem(i));
  335. if (edible)
  336. {
  337. edible.MakeSoundsOnClient(false);
  338. }
  339. }
  340. }
  341. else
  342. {
  343. edible = Edible_Base.Cast(pItem);
  344. if (edible)
  345. {
  346. edible.MakeSoundsOnClient(false);
  347. }
  348. }
  349. }
  350. }
  351. //! Cooking data
  352. protected ItemBase GetItemTypeFromCargo( typename item_type, ItemBase cooking_equipment )
  353. {
  354. CargoBase cargo = cooking_equipment.GetInventory().GetCargo();
  355. if (cargo)
  356. {
  357. for (int i = 0; i < cargo.GetItemCount(); i++)
  358. {
  359. EntityAI entity = cargo.GetItem(i);
  360. if (entity.Type() == item_type)
  361. {
  362. ItemBase item = ItemBase.Cast(entity);
  363. return item;
  364. }
  365. }
  366. }
  367. return null;
  368. }
  369. protected Param2<CookingMethodType, float> GetCookingMethodWithTimeOverride(ItemBase cooking_equipment)
  370. {
  371. if (cooking_equipment.IsCookware())
  372. {
  373. if (cooking_equipment.GetQuantity() > 0)
  374. {
  375. if (cooking_equipment.GetLiquidType() == LIQUID_GASOLINE)
  376. {
  377. //! when cooking in gasoline, jump to drying state(will be burnt then)
  378. return new Param2<CookingMethodType, float>(CookingMethodType.DRYING, TIME_WITHOUT_SUPPORT_MATERIAL_COEF);
  379. }
  380. return new Param2<CookingMethodType, float>(CookingMethodType.BOILING, TIME_WITH_SUPPORT_MATERIAL_COEF);
  381. }
  382. if (GetItemTypeFromCargo(COOKING_INGREDIENT_LARD, cooking_equipment))
  383. {
  384. //has lard in cargo, slower process
  385. return new Param2<CookingMethodType, float>(CookingMethodType.BAKING, TIME_WITH_SUPPORT_MATERIAL_COEF);
  386. }
  387. if (cooking_equipment.GetInventory().GetCargo().GetItemCount() > 0)
  388. {
  389. return new Param2<CookingMethodType, float>(CookingMethodType.BAKING, TIME_WITHOUT_SUPPORT_MATERIAL_COEF);
  390. }
  391. return new Param2<CookingMethodType, float>(CookingMethodType.NONE, TIME_WITHOUT_SUPPORT_MATERIAL_COEF);
  392. }
  393. else if (cooking_equipment.IsLiquidContainer() && cooking_equipment.GetQuantity() > 0 && cooking_equipment.GetLiquidType() != LIQUID_GASOLINE) //fake 'boiling' on liquid containers, for effects playback
  394. {
  395. return new Param2<CookingMethodType, float>(CookingMethodType.BOILING, TIME_WITH_SUPPORT_MATERIAL_COEF);
  396. }
  397. return new Param2<CookingMethodType, float>(CookingMethodType.BAKING, TIME_WITHOUT_SUPPORT_MATERIAL_COEF);
  398. }
  399. Edible_Base GetFoodOnStick( ItemBase stick_item )
  400. {
  401. Edible_Base food_on_stick = Edible_Base.Cast( stick_item.GetAttachmentByType( Edible_Base ) );
  402. return food_on_stick;
  403. }
  404. float GetTimeToCook( Edible_Base item_to_cook, CookingMethodType cooking_method )
  405. {
  406. FoodStageType food_stage_type = item_to_cook.GetNextFoodStageType( cooking_method );
  407. return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.COOK_TIME, food_stage_type, null, item_to_cook.GetType());
  408. }
  409. float GetMinTempToCook( Edible_Base item_to_cook, CookingMethodType cooking_method )
  410. {
  411. FoodStageType food_stage_type = item_to_cook.GetNextFoodStageType( cooking_method );
  412. return FoodStage.GetCookingPropertyFromIndex( eCookingPropertyIndices.MIN_TEMP, food_stage_type, null, item_to_cook.GetType());
  413. }
  414. //add temperature to item
  415. protected void AddTemperatureToItem( ItemBase cooked_item, ItemBase cooking_equipment, float min_temperature )
  416. {
  417. if (!GetGame().IsServer())
  418. return;
  419. if (cooked_item == cooking_equipment) //solves direct cooking double heating
  420. return;
  421. if (cooked_item.CanHaveTemperature())
  422. {
  423. float itemTemp = cooked_item.GetTemperature();
  424. //set target temperature
  425. float targetTemp;
  426. if (!cooked_item.GetHierarchyRoot().GetCookingTargetTemperature(targetTemp)) //if not valid, fallback values enter the equation
  427. {
  428. if (cooking_equipment)
  429. targetTemp = cooking_equipment.GetTemperature();
  430. else
  431. targetTemp = DEFAULT_COOKING_TEMPERATURE;
  432. }
  433. //adjust temperature
  434. if (targetTemp != itemTemp || !cooked_item.IsFreezeThawProgressFinished())
  435. {
  436. float heatPermCoef = 1.0;
  437. if (cooking_equipment)
  438. heatPermCoef = cooking_equipment.GetHeatPermeabilityCoef();
  439. heatPermCoef *= cooked_item.GetHeatPermeabilityCoef();
  440. cooked_item.SetTemperatureEx(new TemperatureDataInterpolated(targetTemp,ETemperatureAccessTypes.ACCESS_COOKING,m_UpdateTime,GameConstants.TEMP_COEF_COOKING_DEFAULT,heatPermCoef));
  441. }
  442. }
  443. }
  444. protected void DecreaseCookedItemQuantity(notnull Edible_Base pItem, float pAmount = 0.0)
  445. {
  446. if (GetGame().IsServer())
  447. {
  448. float quantity = pItem.GetQuantity() - pAmount;
  449. quantity = Math.Clamp(quantity, 0, pItem.GetQuantityMax());
  450. pItem.SetQuantity(quantity);
  451. }
  452. }
  453. ////////////////////////////
  454. //DEPRECATED cooking stuff
  455. //! DEPRECATED
  456. protected CookingMethodType GetCookingMethod(ItemBase cooking_equipment)
  457. {
  458. if (cooking_equipment.Type() == COOKING_EQUIPMENT_POT || cooking_equipment.Type() == COOKING_EQUIPMENT_CAULDRON)
  459. {
  460. //has water, but not petrol dammit X)
  461. if (cooking_equipment.GetQuantity() > 0 && cooking_equipment.GetLiquidType() != LIQUID_GASOLINE)
  462. {
  463. return CookingMethodType.BOILING;
  464. }
  465. //has lard in cargo
  466. if (GetItemTypeFromCargo(COOKING_INGREDIENT_LARD, cooking_equipment))
  467. {
  468. return CookingMethodType.BAKING;
  469. }
  470. return CookingMethodType.DRYING;
  471. }
  472. if (cooking_equipment.Type() == COOKING_EQUIPMENT_FRYINGPAN)
  473. {
  474. if (GetItemTypeFromCargo(COOKING_INGREDIENT_LARD, cooking_equipment))
  475. {
  476. return CookingMethodType.BAKING;
  477. }
  478. return CookingMethodType.DRYING;
  479. }
  480. return CookingMethodType.NONE;
  481. }
  482. }