mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
[PathCamDisabler] Fixes for 2023r171
This commit is contained in:
parent
0e9f7566da
commit
2d6c4a3fc5
4 changed files with 50 additions and 36 deletions
26
PathCamDisabler/HarmonyPatches.cs
Normal file
26
PathCamDisabler/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
using ABI_RC.Core.IO;
|
||||||
|
using ABI_RC.Systems.InputManagement.InputModules;
|
||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace NAK.PathCamDisabler.HarmonyPatches;
|
||||||
|
|
||||||
|
internal class CVRPathCamControllerPatches
|
||||||
|
{
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(CVRPathCamController), nameof(CVRPathCamController.Update))]
|
||||||
|
private static void Prefix_CVRPathCamController_Update(ref bool __runOriginal)
|
||||||
|
{
|
||||||
|
__runOriginal &= !PathCamDisabler.EntryDisablePathCam.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class CVRInputModule_KeyboardPatches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(CVRInputModule_Keyboard), nameof(CVRInputModule_Keyboard.Update_Binds))]
|
||||||
|
private static void Postfix_CVRInputModule_Keyboard_Update_Binds(ref CVRInputModule_Keyboard __instance)
|
||||||
|
{
|
||||||
|
if (PathCamDisabler.EntryDisableFlightBind.Value)
|
||||||
|
__instance._inputManager.toggleFlight = false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,49 +1,34 @@
|
||||||
using ABI_RC.Core.IO;
|
using MelonLoader;
|
||||||
using ABI_RC.Core.Player;
|
|
||||||
using MelonLoader;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace NAK.PathCamDisabler;
|
namespace NAK.PathCamDisabler;
|
||||||
|
|
||||||
public class PathCamDisabler : MelonMod
|
public class PathCamDisabler : MelonMod
|
||||||
{
|
{
|
||||||
public static readonly MelonPreferences_Category Category =
|
public static readonly MelonPreferences_Category Category =
|
||||||
MelonPreferences.CreateCategory(nameof(PathCamDisabler));
|
MelonPreferences.CreateCategory(nameof(PathCamDisabler));
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryDisablePathCam =
|
public static readonly MelonPreferences_Entry<bool> EntryDisablePathCam =
|
||||||
Category.CreateEntry("Disable Path Camera Controller.", true, description: "Disable Path Camera Controller.");
|
Category.CreateEntry("Disable Path Camera Controller", true, description: "Disable Path Camera Controller.");
|
||||||
|
|
||||||
public static readonly MelonPreferences_Entry<bool> EntryDisableFlightBind =
|
public static readonly MelonPreferences_Entry<bool> EntryDisableFlightBind =
|
||||||
Category.CreateEntry("Disable Flight Binding (if controller off).", false, description: "Disable flight bind if Path Camera Controller is also disabled.");
|
Category.CreateEntry("Disable Flight Binding", false, description: "Disable flight bind if Path Camera Controller is also disabled.");
|
||||||
|
|
||||||
public override void OnInitializeMelon()
|
public override void OnInitializeMelon()
|
||||||
{
|
{
|
||||||
EntryDisablePathCam.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
|
ApplyPatches(typeof(HarmonyPatches.CVRPathCamControllerPatches));
|
||||||
|
ApplyPatches(typeof(HarmonyPatches.CVRInputModule_KeyboardPatches));
|
||||||
MelonLoader.MelonCoroutines.Start(WaitForCVRPathCamController());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private System.Collections.IEnumerator WaitForCVRPathCamController()
|
private void ApplyPatches(Type type)
|
||||||
{
|
{
|
||||||
while (CVRPathCamController.Instance == null)
|
try
|
||||||
yield return null;
|
|
||||||
UpdateSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateSettings()
|
|
||||||
{
|
|
||||||
CVRPathCamController.Instance.enabled = !EntryDisablePathCam.Value;
|
|
||||||
}
|
|
||||||
private void OnUpdateSettings(object arg1, object arg2) => UpdateSettings();
|
|
||||||
|
|
||||||
public override void OnUpdate()
|
|
||||||
{
|
|
||||||
if (EntryDisablePathCam.Value && !EntryDisableFlightBind.Value)
|
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(KeyCode.Keypad5))
|
HarmonyInstance.PatchAll(type);
|
||||||
{
|
}
|
||||||
PlayerSetup.Instance._movementSystem.ToggleFlight();
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
|
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||||
|
LoggerInstance.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,10 +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, 155, 89, 182)]
|
||||||
|
[assembly: MelonAuthorColor(255, 158, 21, 32)]
|
||||||
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
namespace NAK.PathCamDisabler.Properties;
|
namespace NAK.PathCamDisabler.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";
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"_id": 110,
|
"_id": 110,
|
||||||
"name": "PathCamDisabler",
|
"name": "PathCamDisabler",
|
||||||
"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/r3/PathCamDisabler.dll",
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r16/PathCamDisabler.dll",
|
||||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/PathCamDisabler/",
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/PathCamDisabler/",
|
||||||
"changelog": "- Organizational changes.\n- No longer using SaveToFile().",
|
"changelog": "- Fixes for 2023r171.",
|
||||||
"embedcolor": "#9b59b6"
|
"embedcolor": "#9b59b6"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue