Decompiled source of SelfLaunch v1.2.2

SelfLaunch.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using MelonLoader;
using SelfLaunch;
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), "SelfLaunch", "1.2.1", "Natino", null)]
[assembly: AssemblyTitle("SelfLaunch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SelfLaunch")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1d672725-2f9b-4a89-8c98-7a3cdb2b5d41")]
[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 SelfLaunch;

public class Main : MelonMod
{
	private static bool launchForward = false;

	private static bool launchBackward = false;

	private static bool launchLeft = false;

	private static bool launchRight = false;

	private static float launchForce = 20f;

	private static readonly Color modColor = new Color(0f, 0.9f, 1f, 1f);

	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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		Page val = Page.Root.CreatePage("SelfLaunch", modColor, 0, true);
		val.CreateBool("Forward Launch", modColor, false, (Action<bool>)delegate(bool flag)
		{
			launchForward = flag;
		});
		val.CreateBool("Backward Launch", modColor, false, (Action<bool>)delegate(bool flag)
		{
			launchBackward = flag;
		});
		val.CreateBool("Left Launch", modColor, false, (Action<bool>)delegate(bool flag)
		{
			launchLeft = flag;
		});
		val.CreateBool("Right Launch", modColor, false, (Action<bool>)delegate(bool flag)
		{
			launchRight = flag;
		});
		val.CreateFloat("Launch Power", modColor, launchForce, 5f, 5f, 200f, (Action<float>)delegate(float num)
		{
			launchForce = num;
		});
	}

	public override void OnUpdate()
	{
		bool keyDown = Input.GetKeyDown((KeyCode)116);
		bool keyDown2 = Input.GetKeyDown((KeyCode)331);
		if (keyDown || keyDown2)
		{
			ExecuteLaunch();
		}
	}

	private void ExecuteLaunch()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		RigManager rigManager = Player.RigManager;
		Transform head = Player.Head;
		if ((Object)(object)rigManager == (Object)null || (Object)(object)rigManager.physicsRig == (Object)null || (Object)(object)head == (Object)null)
		{
			return;
		}
		List<Vector3> list = new List<Vector3>();
		if (launchForward)
		{
			list.Add(head.forward);
		}
		if (launchBackward)
		{
			list.Add(-head.forward);
		}
		if (launchLeft)
		{
			list.Add(-head.right);
		}
		if (launchRight)
		{
			list.Add(head.right);
		}
		if (list.Count == 0)
		{
			return;
		}
		Vector3 val = list[Random.Range(0, list.Count)];
		val.y += 0.3f;
		((Vector3)(ref val)).Normalize();
		Vector3 val2 = val * launchForce;
		Rigidbody val3 = null;
		Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(((Component)rigManager.physicsRig).GetComponentsInChildren<Rigidbody>());
		Rigidbody[] array2 = array;
		foreach (Rigidbody val4 in array2)
		{
			string text = ((Object)((Component)val4).gameObject).name.ToLower();
			if (text.Contains("pelvis") || text.Contains("torso") || text.Contains("chest"))
			{
				val3 = val4;
				break;
			}
		}
		if ((Object)(object)val3 == (Object)null && array.Length != 0)
		{
			val3 = array[0];
		}
		if ((Object)(object)val3 != (Object)null)
		{
			Rigidbody obj = val3;
			obj.velocity += val2;
		}
	}
}