diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 9415dae..8433be7 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: MelonInfo(typeof(FireAddons.FireAddons), "FireAddons", "3.1.2", "ttr")] +[assembly: MelonInfo(typeof(FireAddons.FireAddons), "FireAddons", "3.1.3", "ttr")] [assembly: MelonGame("Hinterland", "TheLongDark")] diff --git a/README.md b/README.md index 2d17c03..21c1202 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ If temperature is between "Normal High threshold" and "Maximal Boost Temperature Any temperature above will cause cooking to be scaled by "High Temp time factor" setting. This also applies to time until food will be ruined (burned), melting snow, boiling and boiling out water. + +Additionally, keeping cooked and hot item on a stove while it's below "Minimal Cooking Temperature" will keep an item hot. ![Cooking time](https://raw.githubusercontent.com/ttr/tld-fireAddons/master/media/cooking.png) ## Notes / Issues. diff --git a/src/Patches.cs b/src/Patches.cs index c7fc0a1..41236fb 100644 --- a/src/Patches.cs +++ b/src/Patches.cs @@ -271,10 +271,19 @@ internal static class CookingPotItem_AttachedFireIsBurning { public static void Postfix(CookingPotItem __instance, ref bool __result) { - if (__instance.m_FireBeingUsed && __instance.m_FireBeingUsed.m_IsPerpetual) { return; } - if (Settings.options.embersSystem && Settings.options.embersSystemNoCooking && __result && __instance.m_FireBeingUsed?.m_EmberTimer > 0) + if (__instance.m_FireBeingUsed) { - __result = false; + if (__instance.m_FireBeingUsed.m_IsPerpetual) { return; } + if (Settings.options.embersSystem && Settings.options.embersSystemNoCooking && __result && __instance.m_FireBeingUsed.m_EmberTimer > 0) + { + __result = false; + } + /* this will work but will prevent using placed items on stove + if (Settings.options.cookingSystem && __result && FireAddons.CookSpeedFromTemp(__instance.m_FireBeingUsed.GetCurrentTempIncrease()) == float.PositiveInfinity) + { + __result = false; + } + */ } } } @@ -298,6 +307,11 @@ public static void Prefix(CookingPotItem __instance, ref float cookTimeMinutes, { if (Settings.options.cookingSystem && __instance.m_FireBeingUsed) { + if (FireAddons.CookSpeedFromTemp(__instance.m_FireBeingUsed.GetCurrentTempIncrease()) == float.PositiveInfinity && __instance.AttachedFireIsBurning()) + { + // roll-back cooking counter as temp is too low + __instance.m_CookingElapsedHours -= GameManager.GetTimeOfDayComponent().GetTODHours(Time.deltaTime); + } cookTimeMinutes *= FireAddons.CookSpeedFromTemp(__instance.m_FireBeingUsed.GetCurrentTempIncrease()); readyTimeMinutes *= FireAddons.CookSpeedFromTemp(__instance.m_FireBeingUsed.GetCurrentTempIncrease()); //MelonLogger.Msg("Cooking speed2: " + cookTimeMinutes + " " + readyTimeMinutes + " " + FireAddons.CookSpeedFromTemp(__instance.m_FireBeingUsed.GetCurrentTempIncrease()));