Decompiled source of AntiPlayerStack v1.0.0

AntiPlayerStack.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AntiPlayerStack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AntiPlayerStack")]
[assembly: AssemblyTitle("AntiPlayerStack")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 AntiPlayerStack
{
	[BepInPlugin("com.yourname.antiplayerstack", "Anti Player Stack", "1.0.1")]
	public class AntiPlayerStack : BaseUnityPlugin
	{
		private Harmony _harmony;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("com.yourname.antiplayerstack");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"AntiPlayerStack loaded (v1.0.1). Players only slide off each other now.");
		}
	}
	[HarmonyPatch(typeof(Character), "OnCollisionStay")]
	public static class Character_OnCollisionStay_Patch
	{
		private static void Postfix(Character __instance, Collision collision)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Player val = (Player)(object)((__instance is Player) ? __instance : null);
				if (val == null)
				{
					return;
				}
				Character component = ((Component)collision.collider).GetComponent<Character>();
				Player val2 = (Player)(object)((component is Player) ? component : null);
				if (val2 != null && ((Component)val).transform.position.y > ((Component)val2).transform.position.y + 0.5f)
				{
					Rigidbody component2 = ((Component)val).GetComponent<Rigidbody>();
					if ((Object)(object)component2 != (Object)null && !((Character)val).IsOnGround())
					{
						component2.AddForce(Vector3.down * 25f, (ForceMode)2);
					}
				}
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"AntiPlayerStack error: {arg}");
			}
		}
	}
}