mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-04 02:49:23 +00:00
Rays layer fix
Desktop tracking scale fix More notifications
This commit is contained in:
parent
fbad3fdf8e
commit
6bc448d41d
8 changed files with 118 additions and 45 deletions
|
@ -7,7 +7,7 @@ Merged set of MelonLoader mods for ChilloutVR.
|
||||||
| Avatar Motion Tweaker | ml_amt | 1.2.2 | Yes | Working |
|
| Avatar Motion Tweaker | ml_amt | 1.2.2 | Yes | Working |
|
||||||
| Desktop Head Tracking | ml_dht | 1.1.1 | Yes | Working |
|
| Desktop Head Tracking | ml_dht | 1.1.1 | Yes | Working |
|
||||||
| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working |
|
| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working |
|
||||||
| Extended Game Notifications | ml_egn | 1.0.0 | Yes | Working
|
| Extended Game Notifications | ml_egn | 1.0.1 | Yes, update review | Working
|
||||||
| Four Point Tracking | ml_fpt | 1.0.9 | Retired | Deprecated | In-game feature since 2022r170 update
|
| Four Point Tracking | ml_fpt | 1.0.9 | Retired | Deprecated | In-game feature since 2022r170 update
|
||||||
| Leap Motion Extension | ml_lme | 1.3.0 | Yes, update review | Working |
|
| Leap Motion Extension | ml_lme | 1.3.0 | Yes, update review | Working |
|
||||||
| Pickup Arm Movement | ml_pam | 1.0.0 | Yes | Working |
|
| Pickup Arm Movement | ml_pam | 1.0.0 | Yes | Working |
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using ABI_RC.Core.EventSystem;
|
using ABI_RC.Core.EventSystem;
|
||||||
using ABI_RC.Core.InteractionSystem;
|
using ABI_RC.Core.InteractionSystem;
|
||||||
|
using ABI_RC.Core.IO;
|
||||||
using ABI_RC.Core.Networking;
|
using ABI_RC.Core.Networking;
|
||||||
using ABI_RC.Core.Util;
|
using ABI_RC.Core.Util;
|
||||||
using DarkRift.Client;
|
using DarkRift.Client;
|
||||||
|
@ -28,6 +29,24 @@ namespace ml_egn
|
||||||
null,
|
null,
|
||||||
new HarmonyLib.HarmonyMethod(typeof(ExtendedGameNotifications).GetMethod(nameof(OnGameNetworkConnectionClosed), BindingFlags.NonPublic | BindingFlags.Static))
|
new HarmonyLib.HarmonyMethod(typeof(ExtendedGameNotifications).GetMethod(nameof(OnGameNetworkConnectionClosed), BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
HarmonyInstance.Patch(
|
||||||
|
typeof(CVRCamImageSaver).GetMethod(nameof(CVRCamImageSaver.SavePicture), BindingFlags.Public | BindingFlags.Static),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(ExtendedGameNotifications).GetMethod(nameof(OnPictureSave), BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
|
);
|
||||||
|
|
||||||
|
HarmonyInstance.Patch(
|
||||||
|
typeof(CVRSyncHelper).GetMethod(nameof(CVRSyncHelper.DeleteAllProps), BindingFlags.Public | BindingFlags.Static),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(ExtendedGameNotifications).GetMethod(nameof(OnAllPropsDelete), BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
|
);
|
||||||
|
|
||||||
|
HarmonyInstance.Patch(
|
||||||
|
typeof(CVRSyncHelper).GetMethod(nameof(CVRSyncHelper.DeleteMyProps), BindingFlags.Public | BindingFlags.Static),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(ExtendedGameNotifications).GetMethod(nameof(OnOwnPropsDelete), BindingFlags.NonPublic | BindingFlags.Static))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnLocalAvatarLoad()
|
static void OnLocalAvatarLoad()
|
||||||
|
@ -82,5 +101,43 @@ namespace ml_egn
|
||||||
MelonLoader.MelonLogger.Error(e);
|
MelonLoader.MelonLogger.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void OnPictureSave()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Utils.ShowHUDNotification("(Local) Client", "Screenshot saved");
|
||||||
|
}
|
||||||
|
catch(System.Exception e)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnAllPropsDelete()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(Utils.IsMenuOpened())
|
||||||
|
Utils.ShowMenuNotification("Props are removed");
|
||||||
|
}
|
||||||
|
catch(System.Exception e)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnOwnPropsDelete()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(Utils.IsMenuOpened())
|
||||||
|
Utils.ShowMenuNotification("Own props are removed");
|
||||||
|
}
|
||||||
|
catch(System.Exception e)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyTitle("ExtendedGameNotifications")]
|
[assembly: AssemblyTitle("ExtendedGameNotifications")]
|
||||||
[assembly: AssemblyVersion("1.0.0")]
|
[assembly: AssemblyVersion("1.0.1")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0")]
|
[assembly: AssemblyFileVersion("1.0.1")]
|
||||||
|
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
|
@ -1,5 +1,9 @@
|
||||||
# Extended Game Notifications
|
# Extended Game Notifications
|
||||||
This mod shows main menu notifications and HUD popups upon avatar changing, prop spawning and server connection loss.
|
This mod shows main menu notifications and HUD popups upon:
|
||||||
|
* Avatar changing
|
||||||
|
* Prop spawning/deletion
|
||||||
|
* Server connection loss
|
||||||
|
* Screenshot saving
|
||||||
Basically, merged previous `Avatar Change Info` and `Server Connection Info` mods in one.
|
Basically, merged previous `Avatar Change Info` and `Server Connection Info` mods in one.
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace ml_lme
|
||||||
base.Start();
|
base.Start();
|
||||||
|
|
||||||
m_inputManager = CVRInputManager.Instance; // _inputManager is stripped out, cool beans
|
m_inputManager = CVRInputManager.Instance; // _inputManager is stripped out, cool beans
|
||||||
m_steamVrModule = this.GetComponent<InputModuleSteamVR>();
|
m_steamVrModule = m_inputManager.GetComponent<InputModuleSteamVR>();
|
||||||
m_inVR = Utils.IsInVR();
|
m_inVR = Utils.IsInVR();
|
||||||
|
|
||||||
m_handRayLeft = LeapTracking.GetInstance().GetLeftHand().gameObject.AddComponent<ControllerRay>();
|
m_handRayLeft = LeapTracking.GetInstance().GetLeftHand().gameObject.AddComponent<ControllerRay>();
|
||||||
|
@ -91,7 +91,9 @@ namespace ml_lme
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
m_lineLeft.material = PlayerSetup.Instance.leftRay.lineRenderer.material;
|
m_lineLeft.material = PlayerSetup.Instance.leftRay.lineRenderer.material;
|
||||||
|
m_lineLeft.gameObject.layer = PlayerSetup.Instance.leftRay.gameObject.layer;
|
||||||
m_lineRight.material = PlayerSetup.Instance.leftRay.lineRenderer.material;
|
m_lineRight.material = PlayerSetup.Instance.leftRay.lineRenderer.material;
|
||||||
|
m_lineRight.gameObject.layer = PlayerSetup.Instance.leftRay.gameObject.layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
|
|
|
@ -158,6 +158,8 @@ namespace ml_lme
|
||||||
// Game events
|
// Game events
|
||||||
internal void OnAvatarClear()
|
internal void OnAvatarClear()
|
||||||
{
|
{
|
||||||
|
if(m_leapTracking != null)
|
||||||
|
m_leapTracking.OnAvatarClear();
|
||||||
if(m_leapTracked != null)
|
if(m_leapTracked != null)
|
||||||
m_leapTracked.OnAvatarClear();
|
m_leapTracked.OnAvatarClear();
|
||||||
}
|
}
|
||||||
|
@ -184,6 +186,12 @@ namespace ml_lme
|
||||||
m_leapInput.OnRayScale(p_scale);
|
m_leapInput.OnRayScale(p_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void OnPlayspaceScale(float p_relation)
|
||||||
|
{
|
||||||
|
if(m_leapTracking != null)
|
||||||
|
m_leapTracking.OnPlayspaceScale(p_relation);
|
||||||
|
}
|
||||||
|
|
||||||
// Arbitrary
|
// Arbitrary
|
||||||
void UpdateDeviceTrackingMode()
|
void UpdateDeviceTrackingMode()
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,8 @@ namespace ml_lme
|
||||||
GameObject m_leapElbowRight = null;
|
GameObject m_leapElbowRight = null;
|
||||||
GameObject m_leapControllerModel = null;
|
GameObject m_leapControllerModel = null;
|
||||||
|
|
||||||
|
float m_scaleRelation = 1f;
|
||||||
|
|
||||||
public static LeapTracking GetInstance() => ms_instance;
|
public static LeapTracking GetInstance() => ms_instance;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
|
@ -75,9 +77,7 @@ namespace ml_lme
|
||||||
while(PlayerSetup.Instance == null)
|
while(PlayerSetup.Instance == null)
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
OnDesktopOffsetChange(Settings.DesktopOffset);
|
|
||||||
OnHeadAttachChange(Settings.HeadAttach);
|
OnHeadAttachChange(Settings.HeadAttach);
|
||||||
OnHeadOffsetChange(Settings.HeadOffset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
|
@ -130,12 +130,7 @@ namespace ml_lme
|
||||||
void OnDesktopOffsetChange(Vector3 p_offset)
|
void OnDesktopOffsetChange(Vector3 p_offset)
|
||||||
{
|
{
|
||||||
if(!Settings.HeadAttach)
|
if(!Settings.HeadAttach)
|
||||||
{
|
this.transform.localPosition = p_offset * (!m_inVR ? m_scaleRelation : 1f);
|
||||||
if(!m_inVR)
|
|
||||||
this.transform.localPosition = p_offset * PlayerSetup.Instance.vrCameraRig.transform.localScale.x;
|
|
||||||
else
|
|
||||||
this.transform.localPosition = p_offset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnModelVisibilityChange(bool p_state)
|
void OnModelVisibilityChange(bool p_state)
|
||||||
|
@ -166,56 +161,44 @@ namespace ml_lme
|
||||||
|
|
||||||
void OnHeadAttachChange(bool p_state)
|
void OnHeadAttachChange(bool p_state)
|
||||||
{
|
{
|
||||||
if(p_state)
|
if(!m_inVR)
|
||||||
{
|
{
|
||||||
if(!m_inVR)
|
this.transform.parent = (p_state ? PlayerSetup.Instance.desktopCamera.transform : PlayerSetup.Instance.desktopCameraRig.transform);
|
||||||
{
|
this.transform.localPosition = (p_state ? Settings.HeadOffset : Settings.DesktopOffset) * m_scaleRelation;
|
||||||
this.transform.parent = PlayerSetup.Instance.desktopCamera.transform;
|
|
||||||
this.transform.localPosition = Settings.HeadOffset * PlayerSetup.Instance.vrCameraRig.transform.localScale.x;
|
|
||||||
this.transform.localScale = PlayerSetup.Instance.vrCameraRig.transform.localScale;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.transform.parent = PlayerSetup.Instance.vrCamera.transform;
|
|
||||||
this.transform.localPosition = Settings.HeadOffset;
|
|
||||||
this.transform.localScale = Vector3.one;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!m_inVR)
|
this.transform.parent = (p_state ? PlayerSetup.Instance.vrCamera.transform : PlayerSetup.Instance.vrCameraRig.transform);
|
||||||
{
|
this.transform.localPosition = (p_state ? Settings.HeadOffset : Settings.DesktopOffset);
|
||||||
this.transform.parent = PlayerSetup.Instance.desktopCameraRig.transform;
|
|
||||||
this.transform.localPosition = Settings.DesktopOffset * PlayerSetup.Instance.vrCameraRig.transform.localScale.x;
|
|
||||||
this.transform.localScale = PlayerSetup.Instance.vrCameraRig.transform.localScale;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.transform.parent = PlayerSetup.Instance.vrCameraRig.transform;
|
|
||||||
this.transform.localPosition = Settings.DesktopOffset;
|
|
||||||
this.transform.localScale = Vector3.one;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.transform.localScale = Vector3.one * (!m_inVR ? m_scaleRelation : 1f);
|
||||||
this.transform.localRotation = Quaternion.Euler(Settings.RootAngle);
|
this.transform.localRotation = Quaternion.Euler(Settings.RootAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnHeadOffsetChange(Vector3 p_offset)
|
void OnHeadOffsetChange(Vector3 p_offset)
|
||||||
{
|
{
|
||||||
if(Settings.HeadAttach)
|
if(Settings.HeadAttach)
|
||||||
{
|
this.transform.localPosition = p_offset * (!m_inVR ? m_scaleRelation : 1f);
|
||||||
if(!m_inVR)
|
|
||||||
this.transform.localPosition = p_offset * PlayerSetup.Instance.vrCameraRig.transform.localScale.x;
|
|
||||||
else
|
|
||||||
this.transform.localPosition = p_offset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Game events
|
// Game events
|
||||||
|
internal void OnAvatarClear()
|
||||||
|
{
|
||||||
|
m_scaleRelation = 1f;
|
||||||
|
OnHeadAttachChange(Settings.HeadAttach);
|
||||||
|
}
|
||||||
|
|
||||||
internal void OnAvatarSetup()
|
internal void OnAvatarSetup()
|
||||||
{
|
{
|
||||||
m_inVR = Utils.IsInVR();
|
m_inVR = Utils.IsInVR();
|
||||||
OnHeadAttachChange(Settings.HeadAttach);
|
OnHeadAttachChange(Settings.HeadAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void OnPlayspaceScale(float p_relation)
|
||||||
|
{
|
||||||
|
m_scaleRelation = p_relation;
|
||||||
|
OnHeadAttachChange(Settings.HeadAttach);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,11 @@ namespace ml_lme
|
||||||
null,
|
null,
|
||||||
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnRayScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnRayScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
);
|
);
|
||||||
|
HarmonyInstance.Patch(
|
||||||
|
typeof(PlayerSetup).GetMethod("SetPlaySpaceScale", BindingFlags.NonPublic | BindingFlags.Instance),
|
||||||
|
null,
|
||||||
|
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
|
);
|
||||||
|
|
||||||
MelonLoader.MelonCoroutines.Start(WaitForRootLogic());
|
MelonLoader.MelonCoroutines.Start(WaitForRootLogic());
|
||||||
}
|
}
|
||||||
|
@ -117,5 +122,19 @@ namespace ml_lme
|
||||||
MelonLoader.MelonLogger.Error(e);
|
MelonLoader.MelonLogger.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void OnPlayspaceScale_Postfix(float ____avatarScaleRelation) => ms_instance?.OnPlayspaceScale(____avatarScaleRelation);
|
||||||
|
void OnPlayspaceScale(float p_relation)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(m_leapManager != null)
|
||||||
|
m_leapManager.OnPlayspaceScale(p_relation);
|
||||||
|
}
|
||||||
|
catch(System.Exception e)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue