[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,119 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Core.Util.Object_Behaviour;
using ABI_RC.Core;
using ABI.CCK.Components;
using UnityEngine;
namespace NAK.ThirdPerson;
internal static class CameraLogic
{
private static float _dist;
private static float _scale = 1f;
private static Camera _thirdPersonCam;
private static Camera _desktopCam;
private static int _storedCamMask;
private static CameraFovClone _cameraFovClone;
internal static CameraLocation CurrentLocation = CameraLocation.Default;
internal enum CameraLocation
{
Default,
FrontView,
RightSide,
LeftSide
}
private static bool _state;
internal static bool State
{
get => _state;
set
{
if (_state == value) return;
_state = !CheckIsRestricted() && value;
if (_state) _storedCamMask = _desktopCam.cullingMask;
_desktopCam.cullingMask = _state ? 0 : _storedCamMask;
_thirdPersonCam.gameObject.SetActive(_state);
}
}
internal static void SetupCamera()
{
_thirdPersonCam = new GameObject("ThirdPersonCameraObj", typeof(Camera)).GetComponent<Camera>();
_cameraFovClone = _thirdPersonCam.gameObject.AddComponent<CameraFovClone>();
_desktopCam = PlayerSetup.Instance.desktopCam;
_cameraFovClone.targetCamera = _desktopCam;
_thirdPersonCam.transform.SetParent(_desktopCam.transform);
RelocateCam(CameraLocation.Default);
_thirdPersonCam.gameObject.SetActive(false);
ThirdPerson.Logger.Msg("Finished setting up third person camera.");
}
internal static void CopyPlayerCamValues()
{
Camera activePlayerCam = PlayerSetup.Instance.activeCam;
if (!_thirdPersonCam || !activePlayerCam)
return;
ThirdPerson.Logger.Msg("Copying active camera settings & components.");
CVRTools.CopyToDestCam(activePlayerCam, _thirdPersonCam);
// Remove PlayerClone
// _thirdPersonCam.cullingMask &= ~(1 << CVRLayers.PlayerClone);
if (!CheckIsRestricted())
return;
ThirdPerson.Logger.Msg("Third person camera is restricted by the world.");
State = false;
}
internal static void RelocateCam(CameraLocation location, bool resetDist = false)
{
Transform thirdPersonCam = _thirdPersonCam.transform;
thirdPersonCam.rotation = _desktopCam.transform.rotation;
if (resetDist) ResetDist();
switch (location)
{
case CameraLocation.FrontView:
thirdPersonCam.localPosition = new Vector3(0, 0.015f, 1f - _dist) * _scale;
thirdPersonCam.localRotation = new Quaternion(0, 180, 0, 0);
CurrentLocation = CameraLocation.FrontView;
break;
case CameraLocation.RightSide:
thirdPersonCam.localPosition = new Vector3(0.3f, 0.015f, -1.5f + _dist) * _scale;
thirdPersonCam.localRotation = new Quaternion(0, 0, 0, 0);
CurrentLocation = CameraLocation.RightSide;
break;
case CameraLocation.LeftSide:
thirdPersonCam.localPosition = new Vector3(-0.3f, 0.015f, -1.5f + _dist) * _scale;
thirdPersonCam.localRotation = new Quaternion(0, 0, 0, 0);
CurrentLocation = CameraLocation.LeftSide;
break;
case CameraLocation.Default:
default:
thirdPersonCam.localPosition = new Vector3(0, 0.015f, -1.5f + _dist) * _scale;
thirdPersonCam.localRotation = new Quaternion(0, 0, 0, 0);
CurrentLocation = CameraLocation.Default;
break;
}
}
private static void ResetDist() => _dist = 0;
internal static void ScrollDist(float sign) { _dist += sign * 0.25f; RelocateCam(CurrentLocation); }
internal static void AdjustScale(float avatarScaleRelation) { _scale = avatarScaleRelation; RelocateCam(CurrentLocation); }
internal static void CheckVRMode() { if (MetaPort.Instance.isUsingVr) State = false; }
private static bool CheckIsRestricted()
=> CVRWorld.Instance && !CVRWorld.Instance.enableZoom;
}

View file

@ -0,0 +1,37 @@
using ABI.CCK.Components;
using ABI_RC.Core.Player;
using MelonLoader;
using System.Reflection;
using static NAK.ThirdPerson.CameraLogic;
using ABI_RC.Core;
namespace NAK.ThirdPerson;
internal static class Patches
{
internal static void Apply(HarmonyLib.Harmony harmony)
{
harmony.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetDefaultCamValues), BindingFlags.Public | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnPostWorldStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
harmony.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.CopyRefCamValues), BindingFlags.Public | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnPostWorldStart), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
harmony.Patch(
typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupIKScaling), BindingFlags.NonPublic | BindingFlags.Instance),
postfix: typeof(Patches).GetMethod(nameof(OnScaleAdjusted), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
harmony.Patch(
typeof(CVRTools).GetMethod(nameof(CVRTools.ConfigureHudAffinity), BindingFlags.Public | BindingFlags.Static),
postfix: typeof(Patches).GetMethod(nameof(OnConfigureHudAffinity), BindingFlags.NonPublic | BindingFlags.Static).ToNewHarmonyMethod()
);
}
//Copy camera settings & postprocessing components
private static void OnPostWorldStart() => CopyPlayerCamValues();
//Adjust camera distance with height as modifier
private static void OnScaleAdjusted(ref float ____avatarScaleRelation) => AdjustScale(____avatarScaleRelation);
private static void OnConfigureHudAffinity() => CheckVRMode();
}

View file

@ -0,0 +1,32 @@
using MelonLoader;
using NAK.ThirdPerson.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.ThirdPerson))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.ThirdPerson))]
[assembly: MelonInfo(
typeof(NAK.ThirdPerson.ThirdPerson),
nameof(NAK.ThirdPerson),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ThirdPerson"
)]
[assembly: MelonGame("ChilloutVR", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(255, 246, 25, 97)] // do not change color, originally chosen by Davi
[assembly: MelonAuthorColor(255, 158, 21, 32)] // do not change color, originally chosen by Davi
[assembly: HarmonyDontPatchAll]
namespace NAK.ThirdPerson.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.1.5";
public const string Author = "Davi & NotAKidoS";
}

View file

@ -0,0 +1,20 @@
# ThirdPerson
Original repo: https://github.com/oestradiol/CVR-Mods
Funni 3rd person mod, but standalone :3
**Current features:**
* Allows you to go into third person view by pressing Ctrl + T;
* Multiple view modes, Ctrl + Y to change between them;
---
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.

View file

@ -0,0 +1,38 @@
using ABI_RC.Systems.GameEventSystem;
using MelonLoader;
using UnityEngine;
using static NAK.ThirdPerson.CameraLogic;
namespace NAK.ThirdPerson;
public class ThirdPerson : MelonMod
{
internal static MelonLogger.Instance Logger;
public override void OnInitializeMelon()
{
Logger = LoggerInstance;
Patches.Apply(HarmonyInstance);
CVRGameEventSystem.Initialization.OnPlayerSetupStart.AddListener(SetupCamera);
}
public override void OnUpdate()
{
// Prevents scrolling while using Effector/BetterInteractDesktop
if (!Input.GetKey(KeyCode.LeftControl))
{
// Prevents scrolling while in Menus or UnityExplorer
if (!State || Cursor.lockState != CursorLockMode.Locked)
return;
float scroll = Input.GetAxis("Mouse ScrollWheel");
if (scroll != 0f) ScrollDist(Mathf.Sign(scroll));
return;
}
if (Input.GetKeyDown(KeyCode.T)) State = !State;
if (!State || !Input.GetKeyDown(KeyCode.Y)) return;
RelocateCam((CameraLocation)(((int)CurrentLocation + (Input.GetKey(KeyCode.LeftShift) ? -1 : 1) + Enum.GetValues(typeof(CameraLocation)).Length) % Enum.GetValues(typeof(CameraLocation)).Length), true);
}
}

View file

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

View file

@ -0,0 +1,22 @@
[
{
"_id": 16,
"name": "ThirdPerson",
"modversion": "1.1.5",
"gameversion": "2025r181",
"loaderversion": "0.7.2",
"modtype": "Mod",
"author": "Davi & NotAKidoS",
"description": "Allows you to go into third person view by pressing Ctrl + T to toggle and Ctrl + Y to cycle modes.",
"searchtags": [
"third person view",
"3rd person",
"third person"
],
"requirements": [],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r48/ThirdPerson.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/ThirdPerson",
"changelog": "- Rebuilt for CVR 2025r181",
"embedcolor": "#F61961"
}
]