ASTExtension: Fixed mouth pointer being fucked

This commit is contained in:
NotAKidoS 2024-07-04 16:43:54 -05:00
parent 6930807665
commit 6ac165f4a8
3 changed files with 17 additions and 13 deletions

View file

@ -2,6 +2,7 @@
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Core.Util;
using ABI_RC.Core.Util.AnimatorManager;
using ABI_RC.Systems.InputManagement;
using ABI.CCK.Components;
@ -73,8 +74,8 @@ public class ASTExtensionMod : MelonMod
);
HarmonyInstance.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupAvatar),
BindingFlags.Public | BindingFlags.Instance),
typeof(ColliderTools).GetMethod(nameof(ColliderTools.PlaceDefaultPointers),
BindingFlags.Public | BindingFlags.Static),
postfix: new HarmonyMethod(typeof(ASTExtensionMod).GetMethod(nameof(OnSetupAvatar),
BindingFlags.NonPublic | BindingFlags.Static))
);
@ -105,8 +106,11 @@ public class ASTExtensionMod : MelonMod
private static void OnGestureRecogniserInitialized()
=> Instance.InitializeScaleGesture();
private static void OnSetupAvatar(ref CVRAvatar ____avatarDescriptor)
=> Instance.OnLocalAvatarLoad(____avatarDescriptor);
private static void OnSetupAvatar(bool isLocalPlayer)
{
if (!isLocalPlayer) return;
Instance.OnLocalAvatarLoad();
}
private static void OnClearAvatar(ref CVRAvatar ____avatarDescriptor)
=> Instance.OnLocalAvatarClear(____avatarDescriptor);
@ -115,7 +119,7 @@ public class ASTExtensionMod : MelonMod
#region Game Events
private void OnLocalAvatarLoad(CVRAvatar _)
private void OnLocalAvatarLoad()
{
if (!FindSupportedParameter(out string parameterName))
return;
@ -272,14 +276,14 @@ public class ASTExtensionMod : MelonMod
animatorManager.GetParameter(parameterName, out float initialValue);
// set min height to 0
animator.SetFloat(parameterName, 0f);
animatorManager.SetParameter(parameterName, 0f);
animator.Update(0f); // apply
minHeight = PlayerSetup.Instance.GetCurrentAvatarHeight();
// set max height to 1++
for (int i = 1; i <= 100; i++)
{
animator.SetFloat(parameterName, i);
animatorManager.SetParameter(parameterName, i);
animator.Update(0f); // apply
var height = PlayerSetup.Instance.GetCurrentAvatarHeight();
if (height <= maxHeight) break; // stop if height is not increasing
@ -288,7 +292,7 @@ public class ASTExtensionMod : MelonMod
}
// reset the parameter to its initial value
animator.SetFloat(parameterName, initialValue);
animatorManager.SetParameter(parameterName, initialValue);
animator.Update(0f); // apply
// check if there was no change

View file

@ -27,6 +27,6 @@ using System.Reflection;
namespace NAK.ASTExtension.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Version = "1.0.1";
public const string Author = "NotAKidoS";
}

View file

@ -1,7 +1,7 @@
{
"_id": 223,
"name": "ASTExtension",
"modversion": "1.0.0",
"modversion": "1.0.1",
"gameversion": "2024r175",
"loaderversion": "0.6.1",
"modtype": "Mod",
@ -17,8 +17,8 @@
"requirements": [
"BTKUILib"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r34/ASTExtension.dll",
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r35/ASTExtension.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ASTExtension/",
"changelog": "- Initial release",
"changelog": "- Fixed an issue where the parameter calibration process would sometimes result in the mouth pointer being misplaced when generated.",
"embedcolor": "#f61963"
}