using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MechaAnimMod")]
[assembly: AssemblyProduct("MechaAnimMod")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MechaAnimMod;
[BepInPlugin("starfi5h.plugin.MechaAnimMod", "MechaAnimMod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "starfi5h.plugin.MechaAnimMod";
public const string NAME = "MechaAnimMod";
public const string VERSION = "1.0.0";
public static ManualLogSource Log;
private static Harmony harmony;
private static int idleAnimIndex;
private static int lastIdleAnimSecond;
public void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
harmony = new Harmony("starfi5h.plugin.MechaAnimMod");
harmony.PatchAll(typeof(Plugin));
}
public void OnDestroy()
{
harmony.UnpatchSelf();
harmony = null;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerAnimator), "DetermineIdleAnims")]
private static void DetermineIdleAnims(PlayerAnimator __instance)
{
if (__instance.idleSeconds - lastIdleAnimSecond <= 6)
{
__instance.idleAnimIndex = idleAnimIndex;
}
if (!VFInput.control || VFInput.inFullscreenGUI)
{
return;
}
for (int i = 0; i < __instance.idles.Length; i++)
{
if (!Input.GetKeyDown((KeyCode)(256 + i)))
{
continue;
}
if (__instance.idleTime > 1f)
{
__instance.idleTime = 0.999f;
}
if (i == idleAnimIndex)
{
for (int j = 0; j < __instance.idles.Length; j++)
{
__instance.idles[j].weight = 0f;
__instance.idles[j].normalizedTime = 0f;
}
}
idleAnimIndex = i;
lastIdleAnimSecond = __instance.idleSeconds;
__instance.idleAnimIndex = idleAnimIndex;
__instance.lastIdleAnimSecond = lastIdleAnimSecond;
break;
}
}
}