mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
[NoDepthOnlyFlat] Initial testing
This commit is contained in:
parent
f1ec83faef
commit
16e44f7c35
5 changed files with 141 additions and 0 deletions
73
NoDepthOnlyFlat/Main.cs
Normal file
73
NoDepthOnlyFlat/Main.cs
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
using ABI_RC.Core.Base;
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using MelonLoader;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Web.Services.Description;
|
||||||
|
using ABI_RC.Systems.Camera;
|
||||||
|
using UnityEngine;
|
||||||
|
using Valve.VR.InteractionSystem;
|
||||||
|
|
||||||
|
namespace NAK.NoDepthOnlyFlat;
|
||||||
|
|
||||||
|
public class NoDepthOnlyFlat : MelonMod
|
||||||
|
{
|
||||||
|
public static readonly MelonPreferences_Category Category =
|
||||||
|
MelonPreferences.CreateCategory(nameof(NoDepthOnlyFlat));
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Entry<bool> EntryUseDepthOnPlayerCamera =
|
||||||
|
Category.CreateEntry("Use Depth On Player Camera", false, description: "Toggle depth texture on player cameras.");
|
||||||
|
|
||||||
|
public static readonly MelonPreferences_Entry<bool> EntryUseDepthOnPortableCamera =
|
||||||
|
Category.CreateEntry("Use Depth On Portable Camera", false, description: "Toggle depth texture on portable camera.");
|
||||||
|
|
||||||
|
public override void OnInitializeMelon()
|
||||||
|
{
|
||||||
|
HarmonyInstance.Patch(
|
||||||
|
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.Start)),
|
||||||
|
postfix: new HarmonyLib.HarmonyMethod(typeof(NoDepthOnlyFlat).GetMethod(nameof(OnPlayerSetupStart_Postfix), BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
|
);
|
||||||
|
|
||||||
|
HarmonyInstance.Patch(
|
||||||
|
typeof(PortableCamera).GetMethod(nameof(PortableCamera.Start)),
|
||||||
|
postfix: new HarmonyLib.HarmonyMethod(typeof(NoDepthOnlyFlat).GetMethod(nameof(OnPortableCameraStart_Postfix), BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach (MelonPreferences_Entry setting in Category.Entries)
|
||||||
|
setting.OnEntryValueChangedUntyped.Subscribe(OnSettingsChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OnSettingsChanged(object oldValue = null, object newValue = null)
|
||||||
|
{
|
||||||
|
SetPlayerSetupCameraDepthTextureMode(EntryUseDepthOnPlayerCamera.Value);
|
||||||
|
SetPortableCameraDepthTextureMode(EntryUseDepthOnPortableCamera.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetPlayerSetupCameraDepthTextureMode(bool useDepth)
|
||||||
|
{
|
||||||
|
if (PlayerSetup.Instance != null)
|
||||||
|
{
|
||||||
|
PlayerSetup.Instance.desktopCamera.GetComponent<Camera>().depthTextureMode = useDepth ? DepthTextureMode.Depth : DepthTextureMode.None;
|
||||||
|
PlayerSetup.Instance.vrCamera.GetComponent<Camera>().depthTextureMode = useDepth ? DepthTextureMode.Depth : DepthTextureMode.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetPortableCameraDepthTextureMode(bool useDepth)
|
||||||
|
{
|
||||||
|
if (PortableCamera.Instance != null)
|
||||||
|
{
|
||||||
|
PortableCamera.Instance._camera.depthTextureMode = useDepth ? DepthTextureMode.Depth : DepthTextureMode.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lazy way to set settings on start
|
||||||
|
|
||||||
|
private static void OnPlayerSetupStart_Postfix()
|
||||||
|
{
|
||||||
|
SetPlayerSetupCameraDepthTextureMode(EntryUseDepthOnPlayerCamera.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnPortableCameraStart_Postfix()
|
||||||
|
{
|
||||||
|
SetPortableCameraDepthTextureMode(EntryUseDepthOnPortableCamera.Value);
|
||||||
|
}
|
||||||
|
}
|
2
NoDepthOnlyFlat/NoDepthOnlyFlat.csproj
Normal file
2
NoDepthOnlyFlat/NoDepthOnlyFlat.csproj
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk" />
|
29
NoDepthOnlyFlat/Properties/AssemblyInfo.cs
Normal file
29
NoDepthOnlyFlat/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
using MelonLoader;
|
||||||
|
using NAK.NoDepthOnlyFlat.Properties;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyTitle(nameof(NAK.NoDepthOnlyFlat))]
|
||||||
|
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||||
|
[assembly: AssemblyProduct(nameof(NAK.NoDepthOnlyFlat))]
|
||||||
|
|
||||||
|
[assembly: MelonInfo(
|
||||||
|
typeof(NAK.NoDepthOnlyFlat.NoDepthOnlyFlat),
|
||||||
|
nameof(NAK.NoDepthOnlyFlat),
|
||||||
|
AssemblyInfoParams.Version,
|
||||||
|
AssemblyInfoParams.Author,
|
||||||
|
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/NoDepthOnlyFlat"
|
||||||
|
)]
|
||||||
|
|
||||||
|
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||||
|
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
|
|
||||||
|
namespace NAK.NoDepthOnlyFlat.Properties;
|
||||||
|
internal static class AssemblyInfoParams
|
||||||
|
{
|
||||||
|
public const string Version = "1.0.0";
|
||||||
|
public const string Author = "NotAKidoS";
|
||||||
|
}
|
14
NoDepthOnlyFlat/README.md
Normal file
14
NoDepthOnlyFlat/README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# NoDepthOnlyFlat
|
||||||
|
|
||||||
|
Sets depth texture mode for player and portable cameras or something. Shit together, have not tested, it could explode.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
|
||||||
|
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||||
|
|
||||||
|
> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive.
|
||||||
|
|
||||||
|
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
|
||||||
|
|
||||||
|
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.
|
23
NoDepthOnlyFlat/format.json
Normal file
23
NoDepthOnlyFlat/format.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"_id": 172,
|
||||||
|
"name": "NoDepthOnlyFlat",
|
||||||
|
"modversion": "1.0.0",
|
||||||
|
"gameversion": "2022r170p1",
|
||||||
|
"loaderversion": "0.6.1",
|
||||||
|
"modtype": "Mod",
|
||||||
|
"author": "Exterrata & NotAKidoS",
|
||||||
|
"description": "A simple mod to add an audio cue for muting and unmuting.\n\nYou can replace the sfx in 'ChilloutVR\\ChilloutVR_Data\\StreamingAssets\\Cohtml\\UIResources\\GameUI\\mods\\NoDepthOnlyFlat\\audio'.",
|
||||||
|
"searchtags": [
|
||||||
|
"mute",
|
||||||
|
"unmute",
|
||||||
|
"audio",
|
||||||
|
"sound"
|
||||||
|
],
|
||||||
|
"requirements": [
|
||||||
|
"None"
|
||||||
|
],
|
||||||
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r13/NoDepthOnlyFlat.dll",
|
||||||
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/NoDepthOnlyFlat/",
|
||||||
|
"changelog": "- Initial CVRMG release",
|
||||||
|
"embedcolor": "92e492"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue