mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
move bunch of things to depricated folder
This commit is contained in:
parent
86828a94e2
commit
21f8893095
156 changed files with 193 additions and 93 deletions
|
@ -1,14 +0,0 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace NAK.SmoothRay.HarmonyPatches;
|
||||
|
||||
internal class PlayerSetupPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Start))]
|
||||
private static void Postfix_PlayerSetup_Start(ref PlayerSetup __instance)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
using MelonLoader;
|
||||
|
||||
namespace NAK.SmoothRay;
|
||||
|
||||
// ChilloutVR adaptation of:
|
||||
// https://github.com/kinsi55/BeatSaber_SmoothedController
|
||||
// https://github.com/kinsi55/BeatSaber_SmoothedController/blob/master/LICENSE
|
||||
|
||||
public class SmoothRay : MelonMod
|
||||
{
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches));
|
||||
}
|
||||
|
||||
private void ApplyPatches(Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
HarmonyInstance.PatchAll(type);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||
LoggerInstance.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
using MelonLoader;
|
||||
using NAK.SmoothRay.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.SmoothRay))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.SmoothRay))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.SmoothRay.SmoothRay),
|
||||
nameof(NAK.SmoothRay),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/SmoothRay"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
[assembly: MelonColor(255, 220, 130, 5)]
|
||||
[assembly: MelonAuthorColor(255, 158, 21, 32)]
|
||||
[assembly: HarmonyDontPatchAll]
|
||||
|
||||
namespace NAK.SmoothRay.Properties;
|
||||
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.3";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
# SmoothRay
|
||||
|
||||
Smoothes your controller while using the Quick and Main menus to make it easier to navigate.
|
||||
|
||||
---
|
||||
|
||||
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.
|
|
@ -1,187 +0,0 @@
|
|||
/**
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Kinsi, NotAKidOnSteam
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
**/
|
||||
|
||||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Savior;
|
||||
using MelonLoader;
|
||||
using UnityEngine;
|
||||
using Valve.VR;
|
||||
|
||||
namespace NAK.SmoothRay;
|
||||
|
||||
public class SmoothRayer : MonoBehaviour
|
||||
{
|
||||
#region Variables
|
||||
|
||||
public ControllerRay ray;
|
||||
|
||||
//settings
|
||||
private bool _isEnabled;
|
||||
private bool _menuOnly;
|
||||
private float _positionSmoothingValue;
|
||||
private float _rotationSmoothingValue;
|
||||
private float _smallMovementThresholdAngle;
|
||||
|
||||
//internal
|
||||
private Vector3 _smoothedPosition = Vector3.zero;
|
||||
private Quaternion _smoothedRotation = Quaternion.identity;
|
||||
private float _angleVelocitySnap = 1f;
|
||||
|
||||
//native & trackedcontrollerfix stuff
|
||||
private SteamVR_Behaviour_Pose _behaviourPose;
|
||||
private SteamVR_TrackedObject _trackedObject;
|
||||
private SteamVR_Events.Action _newPosesAction;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity Methods
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Native ChilloutVR - OpenVR
|
||||
if (TryGetComponent(out _behaviourPose))
|
||||
UpdateTransformUpdatedEvent(true);
|
||||
|
||||
// TrackedControllerFix support - OpenVR
|
||||
if (TryGetComponent(out _trackedObject))
|
||||
{
|
||||
_newPosesAction = SteamVR_Events.NewPosesAppliedAction(OnAppliedPoses);
|
||||
UpdatePosesAction(true);
|
||||
}
|
||||
|
||||
foreach (MelonPreferences_Entry setting in SmoothRay.Category.Entries)
|
||||
setting.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
|
||||
|
||||
OnUpdateSettings(null, null);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
Transform controller = transform;
|
||||
_smoothedPosition = controller.localPosition;
|
||||
_smoothedRotation = controller.localRotation;
|
||||
|
||||
// desktopvrswitch support, start handles this for normal use
|
||||
UpdateTransformUpdatedEvent(true);
|
||||
UpdatePosesAction(true);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
Transform controller = transform;
|
||||
_smoothedPosition = controller.localPosition;
|
||||
_smoothedRotation = controller.localRotation;
|
||||
|
||||
// desktopvrswitch support, normal use wont run this
|
||||
UpdateTransformUpdatedEvent(false);
|
||||
UpdatePosesAction(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void UpdatePosesAction(bool enable)
|
||||
{
|
||||
if (enable && CheckVR.Instance.forceOpenXr)
|
||||
return;
|
||||
|
||||
if (_trackedObject != null && _newPosesAction != null)
|
||||
_newPosesAction.enabled = enable;
|
||||
}
|
||||
|
||||
private void UpdateTransformUpdatedEvent(bool enable)
|
||||
{
|
||||
if (enable && CheckVR.Instance.forceOpenXr)
|
||||
return;
|
||||
|
||||
if (_behaviourPose == null)
|
||||
return;
|
||||
|
||||
if (enable)
|
||||
_behaviourPose.onTransformUpdatedEvent += OnTransformUpdated;
|
||||
else
|
||||
_behaviourPose.onTransformUpdatedEvent -= OnTransformUpdated;
|
||||
}
|
||||
|
||||
private void OnUpdateSettings(object arg1, object arg2)
|
||||
{
|
||||
_isEnabled = SmoothRay.EntryEnabled.Value;
|
||||
_menuOnly = SmoothRay.EntryMenuOnly.Value;
|
||||
_smallMovementThresholdAngle = SmoothRay.EntrySmallMovementThresholdAngle.Value;
|
||||
// dont let value hit 0, itll freeze controllers
|
||||
_positionSmoothingValue = Math.Max(20f - Mathf.Clamp(SmoothRay.EntryPositionSmoothing.Value, 0f, 20f), 0.1f);
|
||||
_rotationSmoothingValue = Math.Max(20f - Mathf.Clamp(SmoothRay.EntryRotationSmoothing.Value, 0f, 20f), 0.1f);
|
||||
}
|
||||
|
||||
private void OnAppliedPoses()
|
||||
{
|
||||
SmoothTransform();
|
||||
}
|
||||
|
||||
private void OnTransformUpdated(SteamVR_Behaviour_Pose pose, SteamVR_Input_Sources inputSource)
|
||||
{
|
||||
SmoothTransform();
|
||||
}
|
||||
|
||||
private void SmoothTransform()
|
||||
{
|
||||
Transform controller = transform;
|
||||
if (_isEnabled && ray.lineRenderer != null && ray.lineRenderer.enabled)
|
||||
{
|
||||
if (_menuOnly && (!ray.uiActive || (ray.hitTransform != ViewManager.Instance.transform &&
|
||||
ray.hitTransform != CVR_MenuManager.Instance.quickMenu.transform)))
|
||||
return;
|
||||
|
||||
var angDiff = Quaternion.Angle(_smoothedRotation, controller.localRotation);
|
||||
_angleVelocitySnap = Mathf.Min(_angleVelocitySnap + angDiff, 90f);
|
||||
|
||||
var snapMulti = Mathf.Clamp(_angleVelocitySnap / _smallMovementThresholdAngle, 0.1f, 2.5f);
|
||||
|
||||
if (_angleVelocitySnap > 0.1f)
|
||||
_angleVelocitySnap -= Mathf.Max(0.4f, _angleVelocitySnap / 1.7f);
|
||||
|
||||
if (_positionSmoothingValue < 20f)
|
||||
{
|
||||
_smoothedPosition = Vector3.Lerp(_smoothedPosition, controller.localPosition,
|
||||
_positionSmoothingValue * Time.deltaTime * snapMulti);
|
||||
controller.localPosition = _smoothedPosition;
|
||||
}
|
||||
|
||||
if (_rotationSmoothingValue < 20f)
|
||||
{
|
||||
_smoothedRotation = Quaternion.Lerp(_smoothedRotation, controller.localRotation,
|
||||
_rotationSmoothingValue * Time.deltaTime * snapMulti);
|
||||
controller.localRotation = _smoothedRotation;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_smoothedPosition = controller.localPosition;
|
||||
_smoothedRotation = controller.localRotation;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk"/>
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"_id": 162,
|
||||
"name": "SmoothRay",
|
||||
"modversion": "1.0.3",
|
||||
"gameversion": "2023r172",
|
||||
"loaderversion": "0.6.1",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Smoothes your controller while using the Quick and Main menus to make it easier to navigate.\nThis is a CVR adaptation of a Beat Saber mod: [BeatSaber_SmoothedController](https://github.com/kinsi55/BeatSaber_SmoothedController)\n\nSupport for TrackedControllerFix & DesktopVRSwitch.\n**Only supports OpenVR, not OpenXR.**",
|
||||
"searchtags": [
|
||||
"vr",
|
||||
"ray",
|
||||
"controller",
|
||||
"smoothing"
|
||||
],
|
||||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r21/SmoothRay.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/SmoothRay/",
|
||||
"changelog": "- Fixes for 2023r172. Literally just recompiled.",
|
||||
"embedcolor": "#dc8105"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue