[NAK_CVR_Mods] Unfucked for 2026r182

This commit is contained in:
NotAKid 2026-06-18 22:20:56 -05:00
parent c13dc8375a
commit 281403d68b
209 changed files with 3936 additions and 1122 deletions

View file

@ -0,0 +1,78 @@
using System.Reflection;
using ABI_RC.Core;
using ABI_RC.Core.Player;
using ABI_RC.Systems.ContentClones;
using ABI_RC.Systems.GameEventSystem;
using ABI.CCK.Components;
using HarmonyLib;
using MelonLoader;
using UnityEngine;
namespace NAK.MirroredReflection;
public class MirroredReflectionMod : MelonMod
{
public override void OnInitializeMelon()
{
CVRGameEventSystem.Avatar.OnLocalAvatarLoad.AddListener(OnLocalAvatarLoad);
CVRGameEventSystem.Avatar.OnLocalAvatarClear.AddListener(OnLocalAvatarClear);
CVRGameEventSystem.Avatar.OnLocalAvatarHeightScale.AddListener(OnLocalAvatarHeightScale);
HarmonyInstance.Patch(
typeof(CVRMirror).GetMethod(nameof(CVRMirror.Start),
BindingFlags.NonPublic | BindingFlags.Instance),
postfix: new HarmonyMethod(typeof(MirroredReflectionMod).GetMethod(nameof(OnPostCVRMirrorStart),
BindingFlags.NonPublic | BindingFlags.Static))
);
}
private static readonly ContentCloneManager.CloneOptions PlayerClone = new()
{
SyncTransforms = true,
SyncRootPosition = true,
SyncRootScale = false,
SyncMaterialSwaps = true,
SyncProbeAnchors = false,
OverrideLayers = true,
CloneLayer = CVRLayers.PlayerClone,
OnlyRenderIfOriginalNotInCamera = true,
ShowCameraTypes = CVRCameraTypeFlags.UserGeneratedContent | CVRCameraTypeFlags.PortableCamera | CVRCameraTypeFlags.MirrorCamera | CVRCameraTypeFlags.CaptureCamera
};
private static ContentCloneManager.CloneData _mirrorClone;
private static void OnLocalAvatarLoad(CVRAvatar avatar)
{
if (!avatar) return;
_mirrorClone = ContentCloneManager.CreateClone(avatar.gameObject, PlayerClone);
if (_mirrorClone != null)
{
_mirrorClone.CloneRootTransform.localScale = new Vector3(-1f, 1f, 1f);
_mirrorClone.LastSourceRootScale = avatar.transform.localScale;
}
}
private static void OnLocalAvatarClear(CVRAvatar avatar)
{
if (_mirrorClone is { IsDestroyed: false })
{
UnityEngine.Object.Destroy(_mirrorClone.CloneRoot);
_mirrorClone = null;
}
}
private static void OnLocalAvatarHeightScale(float height, float scale)
{
if (_mirrorClone is { IsDestroyed: false })
{
Vector3 localScale = PlayerSetup.Instance.AvatarTransform.localScale;
localScale.x *= -1f;
_mirrorClone.CloneRootTransform.localScale = localScale;
}
}
private static void OnPostCVRMirrorStart(CVRMirror __instance)
{
__instance.m_ReflectLayers &= ~(1 << CVRLayers.PlayerLocal); // remove PlayerLocal
__instance.m_ReflectLayers |= (1 << CVRLayers.PlayerClone); // add PlayerClone
}
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>ASTExtension</RootNamespace>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,32 @@
using MelonLoader;
using NAK.MirroredReflection.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.MirroredReflection))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.MirroredReflection))]
[assembly: MelonInfo(
typeof(NAK.MirroredReflection.MirroredReflectionMod),
nameof(NAK.MirroredReflection),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/MirroredReflection"
)]
[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.MirroredReflection.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

View 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 ChilloutVR.
https://docs.chilloutvr.net/official/legal/tos/#6-modding-our-game
> This mod is an independent creation not affiliated with, supported by, or approved by ChilloutVR.
> 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 ChilloutVR.

View 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"
}