Tweak for latest experimental.

Replaced PlayerSetup _inVr check.
This commit is contained in:
NotAKidoS 2022-11-22 18:21:38 -06:00
parent 2b4f306040
commit 24d8c6a3ec
4 changed files with 17 additions and 17 deletions

View file

@ -1,5 +1,7 @@
using ABI_RC.Core.Player; using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using HarmonyLib; using HarmonyLib;
using MelonLoader;
namespace Blackout; namespace Blackout;
@ -11,9 +13,10 @@ internal class HarmonyPatches
[HarmonyPatch(typeof(PlayerSetup), "CalibrateAvatar")] [HarmonyPatch(typeof(PlayerSetup), "CalibrateAvatar")]
private static void CheckVRModeOnSwitch() private static void CheckVRModeOnSwitch()
{ {
if (Blackout.inVR != PlayerSetup.Instance._inVr) if (Blackout.inVR != MetaPort.Instance.isUsingVr)
{ {
Blackout.inVR = PlayerSetup.Instance._inVr; MelonLogger.Msg("VRMode change detected! Reinitializing Blackout Instance...");
Blackout.inVR = MetaPort.Instance.isUsingVr;
BlackoutController.Instance.SetupBlackoutInstance(); BlackoutController.Instance.SetupBlackoutInstance();
BlackoutController.Instance.ChangeBlackoutState(BlackoutController.BlackoutState.Awake); BlackoutController.Instance.ChangeBlackoutState(BlackoutController.BlackoutState.Awake);
} }

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.Player; using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using MelonLoader; using MelonLoader;
namespace Blackout; namespace Blackout;
@ -28,14 +29,10 @@ public class Blackout : MelonMod
m_entryDrowsyDimStrength = m_categoryBlackout.CreateEntry<float>("Drowsy Dim Strength", 0.5f, description: "How strong of a dimming effect should drowsy mode have."); m_entryDrowsyDimStrength = m_categoryBlackout.CreateEntry<float>("Drowsy Dim Strength", 0.5f, description: "How strong of a dimming effect should drowsy mode have.");
m_categoryBlackout.SaveToFile(false); m_categoryBlackout.SaveToFile(false);
m_entryEnabled.OnEntryValueChangedUntyped.Subscribe(OnUpdateEnabled); foreach (var setting in m_categoryBlackout.Entries)
m_entryHudMessages.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); {
m_entryDropFPSOnSleep.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); setting.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
m_entryDrowsyThreshold.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); }
m_entryAwakeThreshold.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
m_entryDrowsyModeTimer.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
m_entrySleepModeTimer.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
m_entryDrowsyDimStrength.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
//UIExpansionKit addon //UIExpansionKit addon
if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "UI Expansion Kit")) if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "UI Expansion Kit"))
@ -55,7 +52,7 @@ public class Blackout : MelonMod
while (PlayerSetup.Instance == null) while (PlayerSetup.Instance == null)
yield return null; yield return null;
inVR = PlayerSetup.Instance._inVr; inVR = MetaPort.Instance.isUsingVr;
PlayerSetup.Instance.gameObject.AddComponent<BlackoutController>(); PlayerSetup.Instance.gameObject.AddComponent<BlackoutController>();
//update BlackoutController settings after it initializes //update BlackoutController settings after it initializes

View file

@ -25,6 +25,6 @@ using System.Reflection;
namespace Blackout.Properties; namespace Blackout.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "1.0.3"; public const string Version = "1.0.4";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }

View file

@ -1,9 +1,9 @@
{ {
"_id": 106, "_id": 106,
"name": "Blackout", "name": "Blackout",
"modversion": "1.0.3", "modversion": "1.0.4",
"gameversion": "2022r169p1", "gameversion": "2022r169",
"loaderversion": "0.5.5", "loaderversion": "0.5.7",
"modtype": "Mod", "modtype": "Mod",
"author": "NotAKidoS", "author": "NotAKidoS",
"description": "Dim screen after set time of sitting still. Should be nice for VR sleeping.\n\nNotable Options:\n Cap FPS while sleeping.\nManual control via UIX\nConfigurable dimming strength.", "description": "Dim screen after set time of sitting still. Should be nice for VR sleeping.\n\nNotable Options:\n Cap FPS while sleeping.\nManual control via UIX\nConfigurable dimming strength.",
@ -16,8 +16,8 @@
"requirements": [ "requirements": [
"None" "None"
], ],
"downloadlink": "https://github.com/NotAKidOnSteam/Blackout/releases/download/r4/Blackout.dll", "downloadlink": "https://github.com/NotAKidOnSteam/Blackout/releases/download/r5/Blackout.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/Blackout/", "sourcelink": "https://github.com/NotAKidOnSteam/Blackout/",
"changelog": "Fixed rendering in every camera other than player camera. Should now behave in both automatic and manual modes.", "changelog": "Small tweak to fix VRMode change detection with latest experimental.",
"embedcolor": "#161b22" "embedcolor": "#161b22"
} }