Decompiled source of Better Gravity v1.0.0

BetterGravity.dll

Decompiled 8 months 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 BepInEx.Logging;
using HarmonyLib;
using Modd.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Modd")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Modd")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("debd42a6-586a-4757-9e9c-4b6f9739f50e")]
[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")]
public class Config
{
	public static ConfigEntry<float> GravityLevel;

	public Config(ConfigFile cfg)
	{
		GravityLevel = cfg.Bind<float>("Gravity Level", "Gravity:", 10f, "gravity, you can make it negative or positive, you are not limited in this. (Float)");
	}
}
namespace Modd
{
	[BepInPlugin("Marcuz.BetterGravity", "Better Gravity", "1.0.0")]
	public class Mod : BaseUnityPlugin
	{
		private const string modGUID = "Marcuz.BetterGravity";

		private const string modName = "Better Gravity";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Marcuz.BetterGravity");

		private static Mod Instance;

		internal ManualLogSource mls;

		public static Config ConfigGravity { get; internal set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Marcuz.BetterGravity");
			mls.LogInfo((object)"BetterGravity Worked!");
			harmony.PatchAll(typeof(Mod));
			harmony.PatchAll(typeof(BetterGravity));
			ConfigGravity = new Config(((BaseUnityPlugin)this).Config);
		}
	}
}
namespace Modd.Patches
{
	[HarmonyPatch(typeof(PlayerController))]
	internal class BetterGravity
	{
		public static float Grav = Config.GravityLevel.Value;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void BetterGravityPatch(ref float ___gravity)
		{
			___gravity = Grav;
		}
	}
}