Decompiled source of MoonLab v1.0.0

Mods/MoonLabs.dll

Decompiled 14 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using MelonLoader;
using MoonLabs;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "Low Gravity Mod", "1.0.0", "zak_sao", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("MoonLabs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoonLabs")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("22339a9d-1888-4541-a78f-f23b2ea3eb60")]
[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 MoonLabs;

public class Main : MelonMod
{
	private static bool isEnabled = true;

	private static float gravityPercentage = 50f;

	private static readonly Vector3 StandardGravity = new Vector3(0f, -9.81f, 0f);

	public override void OnInitializeMelon()
	{
		SetupBoneMenu();
	}

	private void SetupBoneMenu()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		Page val = Page.Root.CreatePage("Low Gravity Mod", Color.white, 0, true);
		val.CreateBool("Mod Enabled", Color.green, isEnabled, (Action<bool>)delegate(bool value)
		{
			isEnabled = value;
			ApplyGravity();
		});
		val.CreateFloat("Gravity %", Color.cyan, gravityPercentage, 5f, 0f, 100f, (Action<float>)delegate(float value)
		{
			gravityPercentage = value;
			ApplyGravity();
		});
		val.CreateFunction("Reset Normal Gravity", Color.yellow, (Action)delegate
		{
			gravityPercentage = 100f;
			ApplyGravity();
		});
	}

	public override void OnUpdate()
	{
		if (Input.GetKeyDown((KeyCode)349))
		{
			isEnabled = !isEnabled;
			ApplyGravity();
			MelonLogger.Msg("Gravity Mod Toggled: " + (isEnabled ? "ENABLED" : "DISABLED"));
		}
	}

	private static void ApplyGravity()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		if (!isEnabled)
		{
			Physics.gravity = StandardGravity;
			return;
		}
		float num = gravityPercentage / 100f;
		Physics.gravity = StandardGravity * num;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		ApplyGravity();
	}
}