Decompiled source of NoFoodBurn v1.1.1

NoFoodBurn.dll

Decompiled 7 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NoFoodBurn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoFoodBurn")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9459213a-dcf2-4327-ab41-f0733958f9ac")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.1.1.0")]
namespace NoFoodBurn;

[BepInPlugin("com.wanheda.nofoodburn", "No Food Burn", "1.1.1")]
public class NoFoodBurnPlugin : BaseUnityPlugin
{
	public const string PluginGUID = "com.wanheda.nofoodburn";

	public const string PluginName = "No Food Burn";

	public const string PluginVersion = "1.1.1";

	public static ConfigEntry<bool> EnableWoodenStation;

	public static ConfigEntry<bool> EnableIronStation;

	public static ConfigEntry<bool> EnableStoneOven;

	public static ConfigEntry<bool> EnableModdedStations;

	private readonly Harmony harmony = new Harmony("com.wanheda.nofoodburn");

	private void Awake()
	{
		EnableWoodenStation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "WoodenCookingStation", true, "Enable anti-burn for the standard wooden cooking station.");
		EnableIronStation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "IronCookingStation", true, "Enable anti-burn for the upgraded iron hanging cooking station.");
		EnableStoneOven = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "StoneOven", true, "Enable anti-burn for the stone oven.");
		EnableModdedStations = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ModdedStations", true, "Enable anti-burn for any custom cooking stations added by other mods.");
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"No Food Burn v1.1.1 loaded successfully!");
	}
}
[HarmonyPatch(typeof(CookingStation), "Awake")]
public static class CookingStation_Awake_Patch
{
	[HarmonyPostfix]
	public static void Postfix(CookingStation __instance)
	{
		if ((Object)(object)__instance == (Object)null)
		{
			return;
		}
		string text = ((Object)((Component)__instance).gameObject).name.ToLower();
		if (text.Contains("cookingstation_iron") || text.Contains("hanging"))
		{
			if (!NoFoodBurnPlugin.EnableIronStation.Value)
			{
				return;
			}
		}
		else if (text.Contains("cookingstation"))
		{
			if (!NoFoodBurnPlugin.EnableWoodenStation.Value)
			{
				return;
			}
		}
		else if (text.Contains("oven"))
		{
			if (!NoFoodBurnPlugin.EnableStoneOven.Value)
			{
				return;
			}
		}
		else if (!NoFoodBurnPlugin.EnableModdedStations.Value)
		{
			return;
		}
		__instance.m_canOvercookItems = false;
	}
}