mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2026-06-22 22:38:30 +00:00
[NAK_CVR_Mods] Unfucked for 2026r182
This commit is contained in:
parent
c13dc8375a
commit
281403d68b
209 changed files with 3936 additions and 1122 deletions
12
.Deprecated/ComfortAlignment/ComfortAlignment.csproj
Normal file
12
.Deprecated/ComfortAlignment/ComfortAlignment.csproj
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<RootNamespace>ASTExtension</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BTKUILib">
|
||||
<HintPath>..\.ManagedLibs\BTKUILib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
166
.Deprecated/ComfortAlignment/Main.cs
Normal file
166
.Deprecated/ComfortAlignment/Main.cs
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
using System.Reflection;
|
||||
using ABI_RC.Core;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.Movement;
|
||||
using ABI_RC.Systems.PersonalPen;
|
||||
using ABI_RC.Systems.UI.UILib;
|
||||
using ABI_RC.Systems.UI.UILib.UIObjects;
|
||||
using ABI_RC.Systems.UI.UILib.UIObjects.Components;
|
||||
using ABI_RC.Systems.XRManagement;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.ComfortAlignment;
|
||||
|
||||
public class ComfortAlignmentMod : MelonMod
|
||||
{
|
||||
private static readonly MelonPreferences_Category Category =
|
||||
MelonPreferences.CreateCategory(nameof(ComfortAlignment));
|
||||
|
||||
private static readonly MelonPreferences_Entry<bool> HiddenAcceptedMotionSicknessWarning =
|
||||
Category.CreateEntry(
|
||||
identifier: "accepted_warning",
|
||||
false,
|
||||
display_name: "Motion Sickness Warning",
|
||||
description: string.Empty,
|
||||
is_hidden: true);
|
||||
|
||||
private static readonly MelonPreferences_Entry<bool> EntrySnapAlignment =
|
||||
Category.CreateEntry(
|
||||
identifier: "snap_alignment",
|
||||
false,
|
||||
display_name: "Snap Alignment",
|
||||
description: "Should the alignment be locked to 90 degrees.");
|
||||
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
HarmonyInstance.Patch(
|
||||
typeof(PenManager).GetMethod(nameof(PenManager.SetupUILib),
|
||||
BindingFlags.Public | BindingFlags.Static),
|
||||
postfix: new HarmonyMethod(typeof(ComfortAlignmentMod).GetMethod(nameof(OnSetupUILib),
|
||||
BindingFlags.NonPublic | BindingFlags.Static))
|
||||
);
|
||||
XRDeviceEvents.OnPostXRModeSwitch.AddListener(OnPostXRModeSwitch);
|
||||
}
|
||||
|
||||
private static Category _category;
|
||||
private static ToggleButton _enableToggle;
|
||||
private static Button _alignToHorizon;
|
||||
private static Button _resetHorizon;
|
||||
private static ToggleButton _snappingToggle;
|
||||
|
||||
private static void OnSetupUILib()
|
||||
{
|
||||
_category = QuickMenuAPI.CVRUtilsPage.AddCategory("Comfort Alignment", true, true);
|
||||
_category.Hidden = !MetaPort.Instance.isUsingVr;
|
||||
|
||||
_enableToggle = _category.AddToggle("Accepted Warning", "Enables the comfort alignment feature.", HiddenAcceptedMotionSicknessWarning.Value);
|
||||
_enableToggle.OnValueUpdated += OnEnableToggled;
|
||||
|
||||
_alignToHorizon = _category.AddButton("Align To Horizon", "Visibility", "Aligns your view to the horizon");
|
||||
_alignToHorizon.OnPress += () => RootLogic.RunInMainThread(AlignHorizon); // scheduled to apply early next frame, to avoid visual jitter
|
||||
_alignToHorizon.Disabled = !HiddenAcceptedMotionSicknessWarning.Value;
|
||||
|
||||
_resetHorizon = _category.AddButton("Reset Horizon", "Visibility", "Resets your view");
|
||||
_resetHorizon.OnPress += () => RootLogic.RunInMainThread(ResetHorizon); // scheduled to apply early next frame, to avoid visual jitter
|
||||
_resetHorizon.Disabled = true;
|
||||
|
||||
_snappingToggle = _category.AddToggle(EntrySnapAlignment.DisplayName, EntrySnapAlignment.Description, EntrySnapAlignment.Value);
|
||||
_snappingToggle.OnValueUpdated += (t) => EntrySnapAlignment.Value = t;
|
||||
_snappingToggle.Disabled = !HiddenAcceptedMotionSicknessWarning.Value;
|
||||
}
|
||||
|
||||
private static void OnEnableToggled(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
QuickMenuAPI.ShowConfirm(
|
||||
"Motion Sickness Warning",
|
||||
"This feature adjusts your playspace orientation to align your view with the world horizon, improving accessibility when playing while reclining or lying down. It may cause motion sickness, dizziness, disorientation, or vertigo, particularly for users sensitive to motion or those new to virtual reality. Enable anyway?",
|
||||
() => SetFeatureEnabled(true),
|
||||
() => _enableToggle.ToggleValue = false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFeatureEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetFeatureEnabled(bool enabled)
|
||||
{
|
||||
_alignToHorizon.Disabled = !enabled;
|
||||
_snappingToggle.Disabled = !enabled;
|
||||
HiddenAcceptedMotionSicknessWarning.Value = enabled;
|
||||
if (!enabled && !_resetHorizon.Disabled) ResetHorizon();
|
||||
}
|
||||
|
||||
private static void OnPostXRModeSwitch(XRModeSwitchEventArgs events)
|
||||
{
|
||||
_category.Hidden = !events.IsUsingVr;
|
||||
if (events.WasUsingVr) ResetHorizonWithoutTeleport();
|
||||
}
|
||||
|
||||
private static void AlignHorizon()
|
||||
{
|
||||
_resetHorizon.Disabled = false;
|
||||
|
||||
// cache original pos to reapply after offsetting vr rig
|
||||
Vector3 playerPos = PlayerSetup.Instance.GetPlayerPosition();
|
||||
Quaternion playerRot = PlayerSetup.Instance.GetPlayerRotation();
|
||||
|
||||
bool snapAlignment = EntrySnapAlignment.Value;
|
||||
|
||||
// pivot point
|
||||
Vector3 camPos = PlayerSetup.Instance.vrCam.transform.position;
|
||||
|
||||
// what we are aligning from
|
||||
Vector3 camUp = PlayerSetup.Instance.vrCam.transform.up;
|
||||
Vector3 camForward = PlayerSetup.Instance.vrCam.transform.forward;
|
||||
|
||||
// what we're aligning to
|
||||
Vector3 playerUp = PlayerSetup.Instance.transform.up;
|
||||
Vector3 playerForward = PlayerSetup.Instance.GetPlayerForward();
|
||||
|
||||
Quaternion correction = Quaternion.FromToRotation(camUp, playerUp);
|
||||
|
||||
if (snapAlignment)
|
||||
{
|
||||
Vector3 refForward = Vector3.ProjectOnPlane(playerForward, playerUp);
|
||||
Vector3 flatForward = Vector3.ProjectOnPlane(correction * camForward, playerUp);
|
||||
if (refForward.sqrMagnitude > 1e-6f && flatForward.sqrMagnitude > 1e-6f)
|
||||
{
|
||||
float yaw = Vector3.SignedAngle(refForward, flatForward, playerUp);
|
||||
float deltaYaw = Mathf.DeltaAngle(yaw, Mathf.Round(yaw / 90f) * 90f);
|
||||
correction = Quaternion.AngleAxis(deltaYaw, playerUp) * correction;
|
||||
}
|
||||
}
|
||||
|
||||
correction.ToAngleAxis(out float angle, out Vector3 axis);
|
||||
if (angle != 0f) PlayerSetup.Instance.vrCameraRig.transform.RotateAround(camPos, axis, angle);
|
||||
|
||||
// reapply player positions (internally re-centers and whatever)
|
||||
BetterBetterCharacterController.Instance.TeleportPlayerTo(playerPos, playerRot.eulerAngles, false, false);
|
||||
}
|
||||
|
||||
private static void ResetHorizon()
|
||||
{
|
||||
_resetHorizon.Disabled = true;
|
||||
|
||||
// cache original pos to reapply after offsetting vr rig
|
||||
Vector3 playerPos = PlayerSetup.Instance.GetPlayerPosition();
|
||||
Quaternion playerRot = PlayerSetup.Instance.GetPlayerRotation();
|
||||
|
||||
PlayerSetup.Instance.vrCameraRig.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
||||
|
||||
// reapply player positions (internally re-centers and whatever)
|
||||
BetterBetterCharacterController.Instance.TeleportPlayerTo(playerPos, playerRot.eulerAngles, false, false);
|
||||
}
|
||||
|
||||
private static void ResetHorizonWithoutTeleport()
|
||||
{
|
||||
_resetHorizon.Disabled = true;
|
||||
PlayerSetup.Instance.vrCameraRig.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
32
.Deprecated/ComfortAlignment/Properties/AssemblyInfo.cs
Normal file
32
.Deprecated/ComfortAlignment/Properties/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using MelonLoader;
|
||||
using NAK.ComfortAlignment.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.ComfortAlignment))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.ComfortAlignment))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.ComfortAlignment.ComfortAlignmentMod),
|
||||
nameof(NAK.ComfortAlignment),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ComfortAlignment"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("ChilloutVR", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
|
||||
[assembly: MelonAuthorColor(255, 158, 21, 32)] // red
|
||||
[assembly: HarmonyDontPatchAll]
|
||||
|
||||
namespace NAK.ComfortAlignment.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.0";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
||||
54
.Deprecated/ComfortAlignment/README.md
Normal file
54
.Deprecated/ComfortAlignment/README.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# ASTExtension
|
||||
|
||||
Extension mod for [Avatar Scale Tool](https://github.com/NotAKidoS/AvatarScaleTool):
|
||||
- VR Gesture to scale
|
||||
- Persistent height
|
||||
- Copy height from others
|
||||
|
||||
Best used with Avatar Scale Tool, but will attempt to work with found scaling setups.
|
||||
Requires already having Avatar Scaling on the avatar. This is **not** Universal Scaling.
|
||||
|
||||
## Supported Setups
|
||||
|
||||
ASTExtension will attempt to work with the following setups:
|
||||
|
||||
**Parameter Names:**
|
||||
- AvatarScale
|
||||
- Scale
|
||||
- Scaler
|
||||
- Scale/Scale
|
||||
- Height
|
||||
- LoliModifier
|
||||
- AvatarSize
|
||||
- Size
|
||||
- SizeScale
|
||||
- Scaling
|
||||
|
||||
These parameter names are not case sensitive and have been gathered from polling the community for common parameter names.
|
||||
|
||||
Assuming the parameter is a float, ASTExtension will attempt to use it as the height parameter. Will automatically calibrate to the height range of the found parameter, assuming the scaling animation is in a blend tree / state using motion time & is linear. The scaling animation state **must be active** at time of avatar load.
|
||||
|
||||
The max value ASTExtension will drive the parameter to is 100. As the mod is having to guess the max height, it may not be accurate if the max height is not capped at a multiple of 10.
|
||||
|
||||
Examples:
|
||||
- `AvatarScale` - 0 to 1 (slider)
|
||||
- This is the default setup for Avatar Scale Tool and will work perfectly.
|
||||
- `Scale` - 0 to 100 (input single)
|
||||
- This will also work perfectly as the max height is a multiple of 10.
|
||||
- `Height` - 0 to 2 (input single)
|
||||
- This will not work properly. The max value to drive the parameter to is not a multiple of 10, and as such ASTExtension will believe the parameter range is 0 to 1.
|
||||
- `BurntToast` - 0 to 10 (input single)
|
||||
- This will not work properly. The parameter name is not recognized by ASTExtension.
|
||||
|
||||
If your setup is theoretically supported but not working, it is likely the scaling animation is not linear or has loop enabled if using Motion Time, making the first and last frame identical height. In this case, you will need to fix your animation clip curves / blend tree to be linear &|| not loop, or use Avatar Scale Tool to generate a new scaling animation.
|
||||
|
||||
---
|
||||
|
||||
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
|
||||
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||
|
||||
> This mod is an independent creation 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.
|
||||
24
.Deprecated/ComfortAlignment/format.json
Normal file
24
.Deprecated/ComfortAlignment/format.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"_id": 223,
|
||||
"name": "ASTExtension",
|
||||
"modversion": "1.0.5",
|
||||
"gameversion": "2025r181",
|
||||
"loaderversion": "0.7.2",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Extension mod for [Avatar Scale Tool](https://github.com/NotAKidoS/AvatarScaleTool):\n- VR Gesture to scale\n- Persistent height\n- Copy height from others\n\nBest used with Avatar Scale Tool, but will attempt to work with found scaling setups.\nRequires already having Avatar Scaling on the avatar. This is **not** Universal Scaling.",
|
||||
"searchtags": [
|
||||
"tool",
|
||||
"scaling",
|
||||
"height",
|
||||
"extension",
|
||||
"avatar"
|
||||
],
|
||||
"requirements": [
|
||||
"BTKUILib"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r48/ASTExtension.dll",
|
||||
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ASTExtension/",
|
||||
"changelog": "- Rebuilt for CVR 2025r181",
|
||||
"embedcolor": "#f61963"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue