[BadAnimatorFix] Fixes for 2023r171

This commit is contained in:
NotAKidoS 2023-07-30 16:23:29 -05:00
parent d3db894acf
commit b20928c2b1
6 changed files with 17 additions and 40 deletions

View file

@ -6,9 +6,9 @@ namespace NAK.BadAnimatorFix;
public static class BadAnimatorFixManager public static class BadAnimatorFixManager
{ {
static List<BadAnimatorFixer> _animatorFixers = new List<BadAnimatorFixer>(); private static List<BadAnimatorFixer> _animatorFixers = new List<BadAnimatorFixer>();
static int _currentIndex = 0; private static int _currentIndex = 0;
static float _checkInterval = 5f; private static float _checkInterval = 5f;
public static void Add(BadAnimatorFixer bad) public static void Add(BadAnimatorFixer bad)
{ {

View file

@ -9,13 +9,9 @@ public class BadAnimatorFixer : MonoBehaviour
private Animator animator; private Animator animator;
void Start() private void Start() => animator = GetComponent<Animator>();
{ private void OnEnable() => BadAnimatorFixManager.Add(this);
animator = GetComponent<Animator>(); private void OnDisable() => BadAnimatorFixManager.Remove(this);
}
void OnEnable() => BadAnimatorFixManager.Add(this);
void OnDisable() => BadAnimatorFixManager.Remove(this);
public void AttemptRewindAnimator() public void AttemptRewindAnimator()
{ {

View file

@ -6,7 +6,7 @@ using UnityEngine;
namespace NAK.BadAnimatorFix.HarmonyPatches; namespace NAK.BadAnimatorFix.HarmonyPatches;
static class AnimatorPatches internal static class AnimatorPatches
{ {
[HarmonyPostfix] [HarmonyPostfix]
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))] [HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
@ -31,24 +31,6 @@ static class AnimatorPatches
AddBadAnimatorFixComponentIfAnimatorExists(__instance.gameObject); AddBadAnimatorFixComponentIfAnimatorExists(__instance.gameObject);
} }
// Set QM stuff
[HarmonyPostfix]
[HarmonyPatch(typeof(CVR_MenuManager), nameof(CVR_MenuManager.Start))]
private static void Postfix_CVR_MenuManager_Start(ref CVR_MenuManager __instance)
{
if (!BadAnimatorFix.EntryMenus.Value) return;
AddBadAnimatorFixComponentIfAnimatorExists(__instance.gameObject);
}
// Set MM stuff
[HarmonyPostfix]
[HarmonyPatch(typeof(ViewManager), nameof(ViewManager.Start))]
private static void Postfix_ViewManager_Start(ref ViewManager __instance)
{
if (!BadAnimatorFix.EntryMenus.Value) return;
AddBadAnimatorFixComponentIfAnimatorExists(__instance.gameObject);
}
private static void AddBadAnimatorFixComponentIfAnimatorExists(GameObject gameObject) private static void AddBadAnimatorFixComponentIfAnimatorExists(GameObject gameObject)
{ {
Animator[] animators = gameObject.GetComponentsInChildren<Animator>(true); Animator[] animators = gameObject.GetComponentsInChildren<Animator>(true);

View file

@ -21,9 +21,6 @@ public class BadAnimatorFix : MelonMod
public static readonly MelonPreferences_Entry<bool> EntryCVRWorld = public static readonly MelonPreferences_Entry<bool> EntryCVRWorld =
Category.CreateEntry("Add to CVRWorld", true, description: "Should BadAnimatorFix run for CVRWorld? Requires world reload."); Category.CreateEntry("Add to CVRWorld", true, description: "Should BadAnimatorFix run for CVRWorld? Requires world reload.");
public static readonly MelonPreferences_Entry<bool> EntryMenus =
Category.CreateEntry("Add to Menus", true, description: "Should BadAnimatorFix run for QM & MM? Requires game restart.");
public static readonly MelonPreferences_Entry<bool> EntryLogging = public static readonly MelonPreferences_Entry<bool> EntryLogging =
Category.CreateEntry("Debugging", false, description: "Toggle to log each rewind if successful. Only needed for debugging."); Category.CreateEntry("Debugging", false, description: "Toggle to log each rewind if successful. Only needed for debugging.");
@ -42,12 +39,12 @@ public class BadAnimatorFix : MelonMod
BadAnimatorFixManager.OnSceneInitialized(sceneName); BadAnimatorFixManager.OnSceneInitialized(sceneName);
} }
void OnEntryEnabledChanged(bool newValue, bool oldValue) private void OnEntryEnabledChanged(bool newValue, bool oldValue)
{ {
BadAnimatorFixManager.ToggleJob(newValue); BadAnimatorFixManager.ToggleJob(newValue);
} }
void ApplyPatches(Type type) private void ApplyPatches(Type type)
{ {
try try
{ {

View file

@ -20,11 +20,13 @@ using System.Reflection;
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] [assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(255, 226, 83, 82)]
[assembly: MelonAuthorColor(255, 158, 21, 32)]
[assembly: HarmonyDontPatchAll] [assembly: HarmonyDontPatchAll]
namespace NAK.BadAnimatorFix.Properties; namespace NAK.BadAnimatorFix.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "1.0.1"; public const string Version = "1.0.2";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }

View file

@ -1,8 +1,8 @@
{ {
"_id": 152, "_id": 152,
"name": "BadAnimatorFix", "name": "BadAnimatorFix",
"modversion": "1.0.1", "modversion": "1.0.2",
"gameversion": "2022r170p1", "gameversion": "2023r171",
"loaderversion": "0.6.1", "loaderversion": "0.6.1",
"modtype": "Mod", "modtype": "Mod",
"author": "NotAKidoS", "author": "NotAKidoS",
@ -16,8 +16,8 @@
"requirements": [ "requirements": [
"None" "None"
], ],
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r11/BadAnimatorFix.dll", "downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r17/BadAnimatorFix.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/BadAnimatorFix/", "sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/BadAnimatorFix/",
"changelog": "- Speculative fix for loading Login, Init, and HQ scenes.", "changelog": "- Fixes for 2023r171.\n- Removed speculative menu fix option. It is no longer needed as menu clips no longer loop.",
"embedcolor": "e25352" "embedcolor": "#e25352"
} }