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

View file

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

View file

@ -1,7 +1,7 @@
{ {
"_id": 223, "_id": 223,
"name": "ASTExtension", "name": "ASTExtension",
"modversion": "1.0.0", "modversion": "1.0.1",
"gameversion": "2024r175", "gameversion": "2024r175",
"loaderversion": "0.6.1", "loaderversion": "0.6.1",
"modtype": "Mod", "modtype": "Mod",
@ -17,8 +17,8 @@
"requirements": [ "requirements": [
"BTKUILib" "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/", "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" "embedcolor": "#f61963"
} }