Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of OverchargeControl v1.0.0
BepInEx/plugins/OverchargeControl/OverchargeControl.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("OverchargeControl")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("OverchargeControl")] [assembly: AssemblyTitle("OverchargeControl")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace OverchargeControl { internal static class Patches { [HarmonyPatch(typeof(PhysGrabber), "PhysGrabOverCharge")] [HarmonyPrefix] private static bool PhysGrabOverChargePrefix(ref float _amount, ref float _multiplier) { if (!Plugin.Enabled.Value) { return true; } if (Plugin.OverchargeDisabled) { return false; } float value = Plugin.OverchargeMultiplier.Value; if (value <= 0f) { return false; } _amount *= value; _multiplier *= value; return true; } [HarmonyPatch(typeof(PhysGrabber), "Update")] [HarmonyPrefix] private static void PhysGrabberUpdatePrefix(PhysGrabber __instance) { if (__instance.isLocal && Plugin.OverchargeDisabled) { __instance.OverrideOverchargeDisable(0.2f); } } } [BepInPlugin("fabian.OverchargeControl", "OverchargeControl", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "fabian.OverchargeControl"; public const string Name = "OverchargeControl"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<int> DisableFromLevel; internal static ConfigEntry<float> OverchargeMultiplier; internal static int CurrentLevel { get { if (!((Object)(object)RunManager.instance != (Object)null)) { return 1; } return RunManager.instance.levelsCompleted + 1; } } internal static bool OverchargeDisabled { get { if (Enabled.Value) { return CurrentLevel >= DisableFromLevel.Value; } return false; } } private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Turns the mod on or off. When off, overcharge behaves like vanilla."); DisableFromLevel = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Disable From Level", 1, new ConfigDescription("Overcharge is completely disabled from this level onward (the level number shown in the truck, 1 = first level). 1 = never any overcharge. Vanilla overcharge only starts at level 10.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); OverchargeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Overcharge Multiplier", 1f, new ConfigDescription("Scales how fast overcharge builds up on levels BEFORE 'Disable From Level'. 1 = vanilla, 0 = no buildup.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); new Harmony("fabian.OverchargeControl").PatchAll(typeof(Patches)); Log.LogInfo((object)"OverchargeControl 1.0.0 loaded."); } } }