Decompiled source of Patch 7 Ragdoll v1.0.0

Mods/Patch7Ragdoll.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using Patch7Ragdoll;
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(global::Patch7Ragdoll.Patch7Ragdoll), "Patch 7 Ragdoll", "1.0.0", "HEIMO", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Patch7Ragdoll")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Patch7Ragdoll")]
[assembly: AssemblyTitle("Patch7Ragdoll")]
[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 Patch7Ragdoll
{
	public class Patch7Ragdoll : MelonMod
	{
		public static MelonPreferences_Category MelonPrefCategory { get; private set; }

		public static MelonPreferences_Entry<bool> MelonPrefRagdollEnabled { get; private set; }

		public static bool _RagdollEnabled { get; private set; }

		public static Page MainPage { get; private set; }

		public override void OnInitializeMelon()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			MelonPrefCategory = MelonPreferences.CreateCategory("Patch 7 Ragdoll");
			MelonPrefRagdollEnabled = MelonPrefCategory.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_RagdollEnabled = MelonPrefRagdollEnabled.Value;
			MainPage = Page.Root.CreatePage("Patch 7 Ragdoll", Color.cyan, 0, true);
			MainPage.CreateBool("Enabled", Color.white, _RagdollEnabled, (Action<bool>)UpdateState);
			Hooking.OnLevelLoaded += OnLevelLoaded;
		}

		public static void OnLevelLoaded(LevelInfo level)
		{
			UpdateState(_RagdollEnabled);
		}

		private static void UpdateState(bool value)
		{
			PhysicsRig physicsRig = Player.PhysicsRig;
			physicsRig.canFall = value;
			physicsRig.manualFallenState = value;
			_RagdollEnabled = value;
			MelonPrefRagdollEnabled.Value = value;
			MelonPrefCategory.SaveToFile(false);
		}
	}
}