Decompiled source of ImprovedStabbing v0.0.1

Mods/ImprovedStabbingMod.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSystem.Collections.Generic;
using ImprovedStabbing;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(ImprovedStabbingMod), "ImprovedStabbing", "1.0.0", "OwO", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("0.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 ImprovedStabbing
{
	public class ImprovedStabbingMod : MelonMod
	{
		public override void OnInitializeMelon()
		{
		}
	}
	[HarmonyPatch(typeof(StabSlash), "Start")]
	public static class StabSlashStartPatch
	{
		[HarmonyPostfix]
		public static void Postfix(StabSlash __instance)
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			Rigidbody rb = __instance.rb;
			if ((Object)(object)rb != (Object)null)
			{
				rb.solverIterations = 30;
				rb.solverVelocityIterations = 30;
				rb.collisionDetectionMode = (CollisionDetectionMode)2;
			}
			if (__instance.stabPoints == null || ((Il2CppArrayBase<StabPoint>)(object)__instance.stabPoints).Length == 0)
			{
				return;
			}
			foreach (StabPoint item in (Il2CppArrayBase<StabPoint>)(object)__instance.stabPoints)
			{
				if (item != null)
				{
					item.linearSpring = 120000f;
					item.linearDamp = 3000f;
					item.sharpness = 1.2f;
					item.depthResistanceMult = 4.5f;
				}
			}
			if (((Il2CppArrayBase<StabPoint>)(object)__instance.stabPoints).Length == 1)
			{
				StabPoint val = ((Il2CppArrayBase<StabPoint>)(object)__instance.stabPoints)[0];
				if (val != null && !((Object)(object)val.pointTran == (Object)null))
				{
					GameObject val2 = new GameObject(((Object)((Component)val.pointTran).gameObject).name + "_BasePointContainer");
					val2.transform.SetParent(val.pointTran.parent, false);
					val2.transform.position = val.pointTran.position - val.pointTran.forward * 0.2f;
					val2.transform.rotation = val.pointTran.rotation;
					StabPoint val3 = new StabPoint();
					val3.pointTran = val2.transform;
					val3.pointCollider = val.pointCollider;
					val3.damage = val.damage;
					val3.sharpness = 1.2f;
					val3.maxDepth = val.maxDepth;
					val3.linearSpring = 120000f;
					val3.linearDamp = 3000f;
					val3.depthResistanceMult = 4.5f;
					List<StabPoint> val4 = new List<StabPoint>();
					val4.Add(val);
					val4.Add(val3);
					__instance.stabPoints = (Il2CppReferenceArray<StabPoint>)(object)val4.ToArray();
				}
			}
		}
	}
	[HarmonyPatch(typeof(StabPoint), "SpawnStab")]
	public static class StabPointSpawnStabPatch
	{
		[HarmonyPostfix]
		public static void Postfix(StabPoint __instance, Transform targetTransform)
		{
		}
	}
	[HarmonyPatch(typeof(StabPoint), "UnStab")]
	public static class StabPointUnStabPatch
	{
		[HarmonyPostfix]
		public static void Postfix(StabPoint __instance, int index)
		{
		}
	}
	[HarmonyPatch(typeof(Grip), "OnAttachedToHand")]
	public static class GripAttachPatch
	{
		[HarmonyPostfix]
		public static void Postfix(Grip __instance, Hand hand)
		{
			if ((Object)(object)__instance == (Object)null || ((HandReciever)__instance).Host == null)
			{
				return;
			}
			Transform transform = ((HandReciever)__instance).Host.GetTransform();
			if ((Object)(object)transform == (Object)null)
			{
				return;
			}
			StabSlash componentInChildren = ((Component)transform).GetComponentInChildren<StabSlash>();
			if (!((Object)(object)componentInChildren == (Object)null))
			{
				Rigidbody rb = componentInChildren.rb;
				if ((Object)(object)rb != (Object)null)
				{
					rb.angularDrag = 3f;
					rb.drag = 1f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Grip), "OnDetachedFromHand")]
	public static class GripDetachPatch
	{
		[HarmonyPostfix]
		public static void Postfix(Grip __instance, Hand hand)
		{
			if ((Object)(object)__instance == (Object)null || ((HandReciever)__instance).Host == null)
			{
				return;
			}
			Transform transform = ((HandReciever)__instance).Host.GetTransform();
			if (!((Object)(object)transform == (Object)null))
			{
				StabSlash componentInChildren = ((Component)transform).GetComponentInChildren<StabSlash>();
				if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.rb != (Object)null)
				{
					componentInChildren.rb.angularDrag = 0.05f;
					componentInChildren.rb.drag = 0f;
				}
			}
		}
	}
}