Decompiled source of MouseMoveMod v1.2.0

!MouseMoveWalkMod.dll

Decompiled 5 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MouseMoveMod;
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(MouseMoveModMain), "MouseMoveMod", "1.2.0", "Cammo", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("MouseMoveWalkMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MouseMoveWalkMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d2e9e4ab-675b-40ee-818f-204a665204b9")]
[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 MouseMoveMod;

public class MouseMoveModMain : MelonMod
{
	private static float sensitivity = 2f;

	private static float maxSpeed = 5f;

	private static bool modEnabled = true;

	public override void OnInitializeMelon()
	{
		MelonLogger.Msg("MouseMoveMod: Initializing...");
		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_0093: Unknown result type (might be due to invalid IL or missing references)
		Page val2 = Page.Root.CreatePage("Mouse Mover", Color.cyan, 0, true);
		val2.CreateBool("Mod Enabled", Color.white, true, (Action<bool>)delegate(bool val)
		{
			modEnabled = val;
			MelonLogger.Msg("Movement " + (modEnabled ? "Enabled" : "Disabled"));
		});
		val2.CreateFloat("Sensitivity", Color.white, 2f, 0.1f, 0.1f, 10f, (Action<float>)delegate(float val)
		{
			sensitivity = val;
		});
		val2.CreateFloat("Max Speed", Color.white, 5f, 0.5f, 1f, 20f, (Action<float>)delegate(float val)
		{
			maxSpeed = val;
		});
	}

	public override void OnUpdate()
	{
		if (modEnabled && !((Object)(object)Player.PhysicsRig == (Object)null) && !((Object)(object)((Rig)Player.PhysicsRig).m_pelvis == (Object)null))
		{
			float axis = Input.GetAxis("Mouse Y");
			if (!(Mathf.Abs(axis) < 0.01f))
			{
				MovePlayer(axis);
			}
		}
	}

	private void MovePlayer(float input)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
		Transform head = ((Rig)Player.PhysicsRig).m_head;
		if ((Object)(object)head == (Object)null)
		{
			return;
		}
		Rigidbody component = ((Component)((Rig)Player.PhysicsRig).m_pelvis).GetComponent<Rigidbody>();
		if (!((Object)(object)component == (Object)null))
		{
			Vector3 forward = head.forward;
			forward.y = 0f;
			((Vector3)(ref forward)).Normalize();
			Vector3 velocity = component.velocity;
			Vector3 val = forward * input * sensitivity;
			Vector3 val2 = velocity + val;
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(val2.x, 0f, val2.z);
			if (((Vector3)(ref val3)).magnitude > maxSpeed)
			{
				val3 = ((Vector3)(ref val3)).normalized * maxSpeed;
				((Vector3)(ref val2))..ctor(val3.x, val2.y, val3.z);
			}
			component.velocity = val2;
		}
	}
}