mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
bruh
This commit is contained in:
parent
6a488abde8
commit
b5fb7bdac6
7 changed files with 328 additions and 0 deletions
61
AASBufferFix/HarmonyPatches.cs
Normal file
61
AASBufferFix/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
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)
|
||||
{
|
||||
AASBufferFix externalBuffer = __instance.AddComponentIfMissing<AASBufferFix>();
|
||||
externalBuffer.puppetMaster = __instance;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PuppetMaster), "AvatarInstantiated")]
|
||||
private static void Postfix_PuppetMaster_AvatarInstantiated(ref PuppetMaster __instance, ref Animator ____animator)
|
||||
{
|
||||
AASBufferFix externalBuffer = __instance.GetComponent<AASBufferFix>();
|
||||
if (externalBuffer != null) externalBuffer.OnAvatarInstantiated(____animator);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PuppetMaster), "AvatarDestroyed")]
|
||||
private static void Postfix_PuppetMaster_AvatarDestroyed(ref PuppetMaster __instance)
|
||||
{
|
||||
AASBufferFix externalBuffer = __instance.GetComponent<AASBufferFix>();
|
||||
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)
|
||||
{
|
||||
AASBufferFix externalBuffer = __instance.GetComponent<AASBufferFix>();
|
||||
if (externalBuffer != null && !externalBuffer.isAcceptingAAS)
|
||||
{
|
||||
externalBuffer.StoreExternalAASBuffer(settingsFloat, settingsInt, settingsByte);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CVRAnimatorManager), "ApplyAdvancedAvatarSettingsFromBuffer")]
|
||||
private static bool Prefix_PuppetMaster_ApplyAdvancedAvatarSettingsFromBuffer(ref Animator ____animator)
|
||||
{
|
||||
AASBufferFix externalBuffer = ____animator.GetComponentInParent<AASBufferFix>();
|
||||
if (externalBuffer != null && !externalBuffer.isAcceptingAAS)
|
||||
{
|
||||
//dont apply if stable buffer no exist
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue