Decompiled source of MulT Lobby Anim Fix v1.0.0

MulteLobbyAnimFix.dll

Decompiled 4 days ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using RoR2;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ThundergunRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThundergunRevised")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5711e2a0-d5a7-4ddf-b8d4-00f355fe9397")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-FI")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MulteLobbyAnimFix;

[BepInPlugin("plonk.multefixbecauseitfuckingpissesmeoff", "MulteLobbyAnimFix", "1.0.0")]
public class MainCode : BaseUnityPlugin
{
	[HarmonyPatch]
	public static class Patches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(CharacterModel), "Awake")]
		public static void Patch(CharacterModel __instance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			MulteRigFixer multeRigFixer = default(MulteRigFixer);
			if (((Scene)(ref activeScene)).name == "lobby" && ((Object)((Component)__instance).transform).name == "mdlToolbot" && !((Component)__instance).TryGetComponent<MulteRigFixer>(ref multeRigFixer))
			{
				((Component)__instance).gameObject.AddComponent<MulteRigFixer>();
			}
		}
	}

	public class MulteRigFixer : MonoBehaviour
	{
		public Animator anim;

		public Dictionary<string, Transform> parts = new Dictionary<string, Transform>();

		private float t;

		public void Awake()
		{
			anim = ((Component)this).GetComponent<Animator>();
		}

		public void OnDisable()
		{
			((Behaviour)anim).enabled = true;
		}

		public void OnEnable()
		{
			t = Time.time;
			parts = new Dictionary<string, Transform>
			{
				{
					"extral",
					((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.l/extraCalf.l")
				},
				{
					"extrar",
					((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.r/extraCalf.r")
				},
				{
					"thighl",
					((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.l")
				},
				{
					"thighr",
					((Component)this).transform.Find("ToolbotArmature/ROOT/base/hip/thigh.r")
				},
				{
					"root",
					((Component)this).transform.Find("ToolbotArmature/ROOT")
				}
			};
		}

		public void Update()
		{
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (((Behaviour)anim).enabled)
			{
				float num = t;
				AnimatorStateInfo currentAnimatorStateInfo = anim.GetCurrentAnimatorStateInfo(0);
				if (num + ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).length < Time.time)
				{
					((Behaviour)anim).enabled = false;
				}
			}
			else
			{
				parts["extral"].localRotation = Quaternion.Lerp(parts["extral"].localRotation, Quaternion.Euler(0f, 90f, 0f), 0.1f);
				parts["extrar"].localRotation = Quaternion.Lerp(parts["extrar"].localRotation, Quaternion.Euler(0f, 90f, 0f), 0.1f);
				parts["thighl"].localRotation = Quaternion.Lerp(parts["thighl"].localRotation, Quaternion.Euler(11.4223f, 179.5351f, 313.506f), 0.1f);
				parts["thighr"].localRotation = Quaternion.Lerp(parts["thighr"].localRotation, Quaternion.Euler(11.7955f, 0.4387f, 46.4209f), 0.1f);
				parts["root"].localPosition = Vector3.Lerp(parts["root"].localPosition, new Vector3(0f, -0.1255f, -0.4491f), 0.1f);
			}
		}
	}

	public void Awake()
	{
		SceneManager.sceneLoaded += OnSceneChange;
	}

	public void Start()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("plonk.multefixbecauseitfuckingpissesmeoff").PatchAll();
	}

	public void OnSceneChange(Scene scene, LoadSceneMode mode)
	{
	}
}