mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
move bunch of things to depricated folder
This commit is contained in:
parent
86828a94e2
commit
21f8893095
156 changed files with 193 additions and 93 deletions
45
.DepricatedMods/BadAnimatorFix/HarmonyPatches.cs
Normal file
45
.DepricatedMods/BadAnimatorFix/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Player;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.BadAnimatorFix.HarmonyPatches;
|
||||
|
||||
internal static class AnimatorPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
|
||||
private static void Postfix_PlayerSetup_Start()
|
||||
{
|
||||
BadAnimatorFixManager.OnPlayerLoaded();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVRAvatar), nameof(CVRAvatar.Start))]
|
||||
private static void Postfix_CVRAvatar_Start(CVRAvatar __instance)
|
||||
{
|
||||
if (!BadAnimatorFix.EntryCVRAvatar.Value) return;
|
||||
AddBadAnimatorFixComponentIfAnimatorExists(__instance.gameObject);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVRSpawnable), nameof(CVRSpawnable.Start))]
|
||||
private static void Postfix_CVRSpawnable_Start(CVRSpawnable __instance)
|
||||
{
|
||||
if (!BadAnimatorFix.EntryCVRSpawnable.Value) return;
|
||||
AddBadAnimatorFixComponentIfAnimatorExists(__instance.gameObject);
|
||||
}
|
||||
|
||||
private static void AddBadAnimatorFixComponentIfAnimatorExists(GameObject gameObject)
|
||||
{
|
||||
Animator[] animators = gameObject.GetComponentsInChildren<Animator>(true);
|
||||
foreach (Animator animator in animators)
|
||||
{
|
||||
if (!animator.TryGetComponent<BadAnimatorFixer>(out _))
|
||||
{
|
||||
animator.gameObject.AddComponent<BadAnimatorFixer>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue