mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
[BadAnimatorFix] Speculative fix for loading Login, Init, and HQ scenes.
Exterrata said it kept erroring but I could not reproduce. This should solve it.
This commit is contained in:
parent
13927f1d67
commit
a902cd250f
6 changed files with 49 additions and 50 deletions
|
@ -6,46 +6,48 @@ public class BadAnimatorFix : MelonMod
|
|||
{
|
||||
internal static MelonLogger.Instance Logger;
|
||||
|
||||
public static readonly MelonPreferences_Category CategoryBadAnimatorFix =
|
||||
public static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(nameof(BadAnimatorFix));
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
|
||||
CategoryBadAnimatorFix.CreateEntry("Enabled", true, description: "Toggle BadAnimatorFix entirely. Requires avatar/spawnable/world reload.");
|
||||
Category.CreateEntry("Enabled", true, description: "Toggle BadAnimatorFix entirely. Requires avatar/spawnable/world reload.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryCVRAvatar =
|
||||
CategoryBadAnimatorFix.CreateEntry("Add to CVRAvatar", true, description: "Should BadAnimatorFix run for CVRAvatar? Requires avatar reload.");
|
||||
Category.CreateEntry("Add to CVRAvatar", true, description: "Should BadAnimatorFix run for CVRAvatar? Requires avatar reload.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryCVRSpawnable =
|
||||
CategoryBadAnimatorFix.CreateEntry("Add to CVRSpawnable", true, description: "Should BadAnimatorFix run for CVRSpawnable? Requires spawnable reload.");
|
||||
Category.CreateEntry("Add to CVRSpawnable", true, description: "Should BadAnimatorFix run for CVRSpawnable? Requires spawnable reload.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryCVRWorld =
|
||||
CategoryBadAnimatorFix.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 =
|
||||
CategoryBadAnimatorFix.CreateEntry("Add to Menus", true, description: "Should BadAnimatorFix run for QM & MM? Requires game restart.");
|
||||
Category.CreateEntry("Add to Menus", true, description: "Should BadAnimatorFix run for QM & MM? Requires game restart.");
|
||||
|
||||
public static readonly MelonPreferences_Entry<bool> EntryLogging =
|
||||
CategoryBadAnimatorFix.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.");
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
Logger = LoggerInstance;
|
||||
EntryEnabled.OnEntryValueChangedUntyped.Subscribe(OnEnabled);
|
||||
EntryEnabled.OnEntryValueChanged.Subscribe(OnEntryEnabledChanged);
|
||||
ApplyPatches(typeof(HarmonyPatches.AnimatorPatches));
|
||||
}
|
||||
|
||||
public override void OnSceneWasInitialized(int buildIndex, string sceneName)
|
||||
{
|
||||
if (!EntryCVRWorld.Value) return;
|
||||
BadAnimatorFixManager.OnSceneInitialized(sceneName);
|
||||
|
||||
if (buildIndex < 0) // -1 is custom world: 0 to 3 is game login, init, hq
|
||||
BadAnimatorFixManager.OnSceneInitialized(sceneName);
|
||||
}
|
||||
|
||||
private void OnEnabled(object arg1, object arg2)
|
||||
void OnEntryEnabledChanged(bool newValue, bool oldValue)
|
||||
{
|
||||
BadAnimatorFixManager.ToggleJob(EntryEnabled.Value);
|
||||
BadAnimatorFixManager.ToggleJob(newValue);
|
||||
}
|
||||
|
||||
private void ApplyPatches(Type type)
|
||||
void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue