mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[AASBufferFix] Fix error when animator is null
This commit is contained in:
parent
6e262bac1b
commit
d04f505d88
5 changed files with 16 additions and 9 deletions
|
@ -27,6 +27,13 @@ public class AASBufferHelper : MonoBehaviour
|
||||||
|
|
||||||
public void OnAvatarInstantiated(Animator animator)
|
public void OnAvatarInstantiated(Animator animator)
|
||||||
{
|
{
|
||||||
|
// have never run into an avatar without an animator until today
|
||||||
|
if (animator == null)
|
||||||
|
{
|
||||||
|
GameHandlesAAS = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//check if avatar uses Avatar Advanced Settings
|
//check if avatar uses Avatar Advanced Settings
|
||||||
///SendDebug("[OnInit] Remote avatar initialized. Checking for AAS...");
|
///SendDebug("[OnInit] Remote avatar initialized. Checking for AAS...");
|
||||||
CVRAvatar avatar = animator.GetComponent<CVRAvatar>();
|
CVRAvatar avatar = animator.GetComponent<CVRAvatar>();
|
||||||
|
|
|
@ -21,15 +21,17 @@ internal class HarmonyPatches
|
||||||
private static void Postfix_PuppetMaster_AvatarInstantiated(ref PuppetMaster __instance, ref Animator ____animator)
|
private static void Postfix_PuppetMaster_AvatarInstantiated(ref PuppetMaster __instance, ref Animator ____animator)
|
||||||
{
|
{
|
||||||
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
||||||
if (externalBuffer != null) externalBuffer.OnAvatarInstantiated(____animator);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
externalBuffer?.OnAvatarInstantiated(____animator);
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(PuppetMaster), "AvatarDestroyed")]
|
[HarmonyPatch(typeof(PuppetMaster), "AvatarDestroyed")]
|
||||||
private static void Postfix_PuppetMaster_AvatarDestroyed(ref PuppetMaster __instance)
|
private static void Postfix_PuppetMaster_AvatarDestroyed(ref PuppetMaster __instance)
|
||||||
{
|
{
|
||||||
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
||||||
if (externalBuffer != null) externalBuffer.OnAvatarDestroyed();
|
|
||||||
|
externalBuffer?.OnAvatarDestroyed();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
|
|
|
@ -24,6 +24,6 @@ using System.Reflection;
|
||||||
namespace NAK.AASBufferFix.Properties;
|
namespace NAK.AASBufferFix.Properties;
|
||||||
internal static class AssemblyInfoParams
|
internal static class AssemblyInfoParams
|
||||||
{
|
{
|
||||||
public const string Version = "1.0.5";
|
public const string Version = "1.0.6";
|
||||||
public const string Author = "NotAKidoS";
|
public const string Author = "NotAKidoS";
|
||||||
}
|
}
|
|
@ -20,8 +20,6 @@ public class Utils
|
||||||
case AnimatorControllerParameterType.Float:
|
case AnimatorControllerParameterType.Float:
|
||||||
avatarFloatCount++;
|
avatarFloatCount++;
|
||||||
break;
|
break;
|
||||||
case (AnimatorControllerParameterType)2:
|
|
||||||
break;
|
|
||||||
case AnimatorControllerParameterType.Int:
|
case AnimatorControllerParameterType.Int:
|
||||||
avatarIntCount++;
|
avatarIntCount++;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_id": 126,
|
"_id": 126,
|
||||||
"name": "AASBufferFix",
|
"name": "AASBufferFix",
|
||||||
"modversion": "1.0.5",
|
"modversion": "1.0.6",
|
||||||
"gameversion": "2022r170",
|
"gameversion": "2022r170",
|
||||||
"loaderversion": "0.5.7",
|
"loaderversion": "0.5.7",
|
||||||
"modtype": "Mod",
|
"modtype": "Mod",
|
||||||
|
@ -16,8 +16,8 @@
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"None"
|
"None"
|
||||||
],
|
],
|
||||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/AASBufferFix.dll",
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r9/AASBufferFix.dll",
|
||||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/AASBufferFix/",
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/AASBufferFix/",
|
||||||
"changelog": "",
|
"changelog": "Fixed an error when a remote avatar does not have an Animator component.",
|
||||||
"embedcolor": "9b59b6"
|
"embedcolor": "9b59b6"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue