Decompiled source of ReducedFarmingPower v1.0.0

plugins/ReducedPower.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using EquinoxsModUtils;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ReducedPower")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReducedPower")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3872d7b8-67a2-4507-8778-bec3c86fea75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ReducedPower
{
	[BepInPlugin("com.equinox.ReducedPower", "ReducedPower", "1.0.0")]
	public class ReducedPowerPlugin : BaseUnityPlugin
	{
		private const string MyGUID = "com.equinox.ReducedPower";

		private const string PluginName = "ReducedPower";

		private const string VersionString = "1.0.0";

		private static readonly Harmony Harmony = new Harmony("com.equinox.ReducedPower");

		public static ManualLogSource Log = new ManualLogSource("ReducedPower");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ReducedPower, VersionString: 1.0.0 is loading...");
			Harmony.PatchAll();
			ModUtils.GameDefinesLoaded += OnGameDefinesLoaded;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ReducedPower, VersionString: 1.0.0 is loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
		}

		private void OnGameDefinesLoaded(object sender, EventArgs e)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			((BuilderInfo)ModUtils.GetResourceInfoByName("Planter", false)).kWPowerConsumption = 12;
			((BuilderInfo)ModUtils.GetResourceInfoByName("Thresher", false)).kWPowerConsumption = 50;
		}
	}
}
namespace ReducedPower.Patches
{
	internal class PlanterInstancePatch
	{
		[HarmonyPatch(typeof(PlanterInstance), "SimUpdate")]
		[HarmonyPostfix]
		private static void reducePower(PlanterInstance __instance)
		{
			Debug.Log((object)"Setting power to 50");
			__instance.powerInfo.maxPowerConsumption = 50;
		}
	}
}