diff --git a/PathCamDisabler/Main.cs b/PathCamDisabler/Main.cs index 4d21597..0087741 100644 --- a/PathCamDisabler/Main.cs +++ b/PathCamDisabler/Main.cs @@ -1,51 +1,48 @@ -using ABI_RC.Core.Player; -using ABI_RC.Core.IO; +using ABI_RC.Core.IO; +using ABI_RC.Core.Player; using MelonLoader; using UnityEngine; -namespace PathCamDisabler; - -public class PathCamDisabler : MelonMod +namespace NAK.Melons.PathCamDisabler { - private static MelonPreferences_Category m_categoryPathCamDisabler; - private static MelonPreferences_Entry m_entryDisablePathCam, m_entryDisableFlightBind; - - public override void OnInitializeMelon() + public class PathCamDisablerMod : MelonMod { - m_categoryPathCamDisabler = MelonPreferences.CreateCategory(nameof(PathCamDisabler)); - m_entryDisablePathCam = m_categoryPathCamDisabler.CreateEntry("Disable Path Camera Controller.", true, description: "Disable path camera controller so you can use your numpad keys without funky shit."); - m_entryDisableFlightBind = m_categoryPathCamDisabler.CreateEntry("Disable Flight Binding (if controller off).", false, description: "Disables the flight binding as the path camera controller handles that...?"); - m_categoryPathCamDisabler.SaveToFile(false); + internal const string SettingsCategory = "PathCamDisabler"; + internal static MelonPreferences_Category m_categoryPathCamDisabler; + internal static MelonPreferences_Entry m_entryDisablePathCam, m_entryDisableFlightBind; - foreach (var setting in m_categoryPathCamDisabler.Entries) + public override void OnInitializeMelon() { - setting.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); + m_categoryPathCamDisabler = MelonPreferences.CreateCategory(SettingsCategory); + m_entryDisablePathCam = m_categoryPathCamDisabler.CreateEntry("Disable Path Camera Controller.", true, description: "Disable Path Camera Controller."); + m_entryDisableFlightBind = m_categoryPathCamDisabler.CreateEntry("Disable Flight Binding (if controller off).", false, description: "Disable flight bind if Path Camera Controller is also disabled."); + + m_entryDisablePathCam.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings); + + MelonLoader.MelonCoroutines.Start(WaitForCVRPathCamController()); } - MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer()); - } - - System.Collections.IEnumerator WaitForLocalPlayer() - { - while (CVRPathCamController.Instance == null) - yield return null; - UpdateSettings(); - } - - private void UpdateSettings() - { - CVRPathCamController.Instance.enabled = !m_entryDisablePathCam.Value; - } - - private void OnUpdateSettings(object arg1, object arg2) => UpdateSettings(); - - public override void OnUpdate() - { - if (m_entryDisablePathCam.Value && !m_entryDisableFlightBind.Value) + private System.Collections.IEnumerator WaitForCVRPathCamController() { - if (Input.GetKeyDown(KeyCode.Keypad5)) + while (CVRPathCamController.Instance == null) + yield return null; + UpdateSettings(); + } + + private void UpdateSettings() + { + CVRPathCamController.Instance.enabled = !m_entryDisablePathCam.Value; + } + private void OnUpdateSettings(object arg1, object arg2) => UpdateSettings(); + + public override void OnUpdate() + { + if (m_entryDisablePathCam.Value && !m_entryDisableFlightBind.Value) { - PlayerSetup.Instance._movementSystem.ToggleFlight(); + if (Input.GetKeyDown(KeyCode.Keypad5)) + { + PlayerSetup.Instance._movementSystem.ToggleFlight(); + } } } } diff --git a/PathCamDisabler/Properties/AssemblyInfo.cs b/PathCamDisabler/Properties/AssemblyInfo.cs index 652ae4d..6de051d 100644 --- a/PathCamDisabler/Properties/AssemblyInfo.cs +++ b/PathCamDisabler/Properties/AssemblyInfo.cs @@ -1,18 +1,17 @@ -using PathCamDisabler.Properties; -using MelonLoader; +using MelonLoader; using System.Reflection; - +using NAK.Melons.PathCamDisabler.Properties; [assembly: AssemblyVersion(AssemblyInfoParams.Version)] [assembly: AssemblyFileVersion(AssemblyInfoParams.Version)] [assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)] -[assembly: AssemblyTitle(nameof(PathCamDisabler))] +[assembly: AssemblyTitle(nameof(NAK.Melons.PathCamDisabler))] [assembly: AssemblyCompany(AssemblyInfoParams.Author)] -[assembly: AssemblyProduct(nameof(PathCamDisabler))] +[assembly: AssemblyProduct(nameof(NAK.Melons.PathCamDisabler))] [assembly: MelonInfo( - typeof(PathCamDisabler.PathCamDisabler), - nameof(PathCamDisabler), + typeof(NAK.Melons.PathCamDisabler.PathCamDisablerMod), + nameof(NAK.Melons.PathCamDisabler), AssemblyInfoParams.Version, AssemblyInfoParams.Author, downloadLink: "https://github.com/NotAKidOnSteam/PathCamDisabler" @@ -22,9 +21,9 @@ using System.Reflection; [assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] -namespace PathCamDisabler.Properties; +namespace NAK.Melons.PathCamDisabler.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.0"; + public const string Version = "1.0.1"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/PathCamDisabler/format.json b/PathCamDisabler/format.json index 83fe58a..b8a4315 100644 --- a/PathCamDisabler/format.json +++ b/PathCamDisabler/format.json @@ -1,12 +1,12 @@ { "_id": 110, "name": "PathCamDisabler", - "modversion": "1.0.0", - "gameversion": "2022r169", + "modversion": "1.0.1", + "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", "author": "NotAKidoS", - "description": "Disables path camera controller to free up your numkeys. Additional option to disable the flight binding. \n\n Won't do much for VR. Can toggle with UIExpansionKit or similar.", + "description": "Adds option to disable the Path Camera Controller to free up your numkeys.\nAdditional option to disable flight binding.", "searchtags": [ "numpad", "camera", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/PathCamDisabler/releases/download/r1/PathCamDisabler.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/PathCamDisabler/releases/download/v1.0.1/PathCamDisabler.dll", "sourcelink": "https://github.com/NotAKidOnSteam/PathCamDisabler/", - "changelog": "initial release\n(i made this in 5 minutes after months of annoyances)", + "changelog": "- Organizational changes.\n- No longer using SaveToFile().", "embedcolor": "#9b59b6" } \ No newline at end of file