mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
61 lines
No EOL
2.3 KiB
C#
61 lines
No EOL
2.3 KiB
C#
using ABI_RC.Core;
|
|
using ABI_RC.Core.Base;
|
|
using ABI_RC.Core.Player;
|
|
using HarmonyLib;
|
|
using UnityEngine;
|
|
|
|
namespace NAK.Melons.AASBufferFix.HarmonyPatches;
|
|
|
|
[HarmonyPatch]
|
|
internal class HarmonyPatches
|
|
{
|
|
[HarmonyPostfix]
|
|
[HarmonyPatch(typeof(PuppetMaster), "Start")]
|
|
private static void Postfix_PuppetMaster_Start(ref PuppetMaster __instance)
|
|
{
|
|
AASBufferHelper externalBuffer = __instance.AddComponentIfMissing<AASBufferHelper>();
|
|
externalBuffer.puppetMaster = __instance;
|
|
}
|
|
|
|
[HarmonyPostfix]
|
|
[HarmonyPatch(typeof(PuppetMaster), "AvatarInstantiated")]
|
|
private static void Postfix_PuppetMaster_AvatarInstantiated(ref PuppetMaster __instance, ref Animator ____animator)
|
|
{
|
|
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
|
if (externalBuffer != null) externalBuffer.OnAvatarInstantiated(____animator);
|
|
}
|
|
|
|
[HarmonyPostfix]
|
|
[HarmonyPatch(typeof(PuppetMaster), "AvatarDestroyed")]
|
|
private static void Postfix_PuppetMaster_AvatarDestroyed(ref PuppetMaster __instance)
|
|
{
|
|
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
|
if (externalBuffer != null) externalBuffer.OnAvatarDestroyed();
|
|
}
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(typeof(PuppetMaster), "ApplyAdvancedAvatarSettings")]
|
|
private static bool Prefix_PuppetMaster_ApplyAdvancedAvatarSettings(float[] settingsFloat, int[] settingsInt, byte[] settingsByte, ref PuppetMaster __instance)
|
|
{
|
|
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
|
if (externalBuffer != null && !externalBuffer.isAcceptingAAS)
|
|
{
|
|
externalBuffer.OnApplyAAS(settingsFloat, settingsInt, settingsByte);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(typeof(CVRAnimatorManager), "ApplyAdvancedAvatarSettingsFromBuffer")]
|
|
private static bool Prefix_PuppetMaster_ApplyAdvancedAvatarSettingsFromBuffer(ref Animator ____animator)
|
|
{
|
|
AASBufferHelper externalBuffer = ____animator.GetComponentInParent<AASBufferHelper>();
|
|
if (externalBuffer != null && !externalBuffer.isAcceptingAAS)
|
|
{
|
|
//dont apply if stable buffer no exist
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
} |