diff --git a/README.md b/README.md index 842aede..2b58ae7 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ Merged set of MelonLoader mods for ChilloutVR. | Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) | Current Status | Notes | |-----------|------------|----------------|-----------------------------------------------------------------|----------------|-------| | Avatar Change Info | ml_aci | 1.0.1 | Yes | Working | -| Avatar Motion Tweaker | ml_amt | 1.0.0 | Pending approval | Working | +| Avatar Motion Tweaker | ml_amt | 1.0.2 | Pending approval | Working | | Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | | Four Point Tracking | ml_fpt | 1.0.1 | Yes | Working | -| Leap Motion Extension | ml_lme | 1.1.3 | Pending approval | Working | +| Leap Motion Extension | ml_lme | 1.1.4 | Pending approval | Working | +| Server Connection Info | ml_sci | 1.0.0 | Pending approval | Working | diff --git a/ml_amt/MotionTweaker.cs b/ml_amt/MotionTweaker.cs index 2acac50..4ef09fd 100644 --- a/ml_amt/MotionTweaker.cs +++ b/ml_amt/MotionTweaker.cs @@ -28,6 +28,8 @@ namespace ml_amt RootMotion.FinalIK.VRIK m_vrIk = null; + bool m_ready = false; + bool m_standing = true; float m_currentUpright = 1f; float m_locomotionWeight = 1f; @@ -49,38 +51,41 @@ namespace ml_amt void Update() { - // Update upright - Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * (PlayerSetup.Instance._inVr ? PlayerSetup.Instance.vrHeadTracker.transform.GetMatrix() : PlayerSetup.Instance.desktopCameraRig.transform.GetMatrix()); - float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue); - float l_avatarViewHeight = Mathf.Clamp(PlayerSetup.Instance.GetViewPointHeight() * PlayerSetup.Instance._avatar.transform.localScale.y, 0f, float.MaxValue); - m_currentUpright = Mathf.Clamp((((l_currentHeight > 0f) && (l_avatarViewHeight > 0f)) ? (l_currentHeight / l_avatarViewHeight) : 0f), 0f, 1f); - m_standing = (m_currentUpright > m_crouchLimit); - - if((m_vrIk != null) && m_vrIk.enabled && !PlayerSetup.Instance._movementSystem.sitting && (PlayerSetup.Instance._movementSystem.movementVector.magnitude <= Mathf.Epsilon) && !PlayerSetup.Instance.fullBodyActive) + if(m_ready) { - m_locomotionWeight = Mathf.Lerp(m_locomotionWeight, m_standing ? 1f : 0f, 0.5f); - m_vrIk.solver.locomotion.weight = m_locomotionWeight; - } + // Update upright + Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * (PlayerSetup.Instance._inVr ? PlayerSetup.Instance.vrHeadTracker.transform.GetMatrix() : PlayerSetup.Instance.desktopCameraRig.transform.GetMatrix()); + float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue); + float l_avatarViewHeight = Mathf.Clamp(PlayerSetup.Instance.GetViewPointHeight() * PlayerSetup.Instance._avatar.transform.localScale.y, 0f, float.MaxValue); + m_currentUpright = Mathf.Clamp((((l_currentHeight > 0f) && (l_avatarViewHeight > 0f)) ? (l_currentHeight / l_avatarViewHeight) : 0f), 0f, 1f); + m_standing = (m_currentUpright > m_crouchLimit); - if(m_parameters.Count > 0) - { - foreach(AdditionalParameterInfo l_param in m_parameters) + if((m_vrIk != null) && m_vrIk.enabled && !PlayerSetup.Instance._movementSystem.sitting && (PlayerSetup.Instance._movementSystem.movementVector.magnitude <= Mathf.Epsilon) && !PlayerSetup.Instance.fullBodyActive) { - switch(l_param.m_type) + m_locomotionWeight = Mathf.Lerp(m_locomotionWeight, m_standing ? 1f : 0f, 0.5f); + m_vrIk.solver.locomotion.weight = m_locomotionWeight; + } + + if(m_parameters.Count > 0) + { + foreach(AdditionalParameterInfo l_param in m_parameters) { - case ParameterType.Upright: + switch(l_param.m_type) { - switch(l_param.m_sync) + case ParameterType.Upright: { - case ParameterSyncType.Local: - PlayerSetup.Instance._animator.SetFloat(l_param.m_hash, m_currentUpright); - break; - case ParameterSyncType.Synced: - PlayerSetup.Instance.changeAnimatorParam(l_param.m_name, m_currentUpright); - break; + switch(l_param.m_sync) + { + case ParameterSyncType.Local: + PlayerSetup.Instance._animator.SetFloat(l_param.m_hash, m_currentUpright); + break; + case ParameterSyncType.Synced: + PlayerSetup.Instance.changeAnimatorParam(l_param.m_name, m_currentUpright); + break; + } } + break; } - break; } } } @@ -89,6 +94,7 @@ namespace ml_amt public void OnAvatarClear() { m_vrIk = null; + m_ready = false; m_standing = true; m_parameters.Clear(); m_locomotionWeight = 1f; @@ -128,6 +134,8 @@ namespace ml_amt Transform l_customLimit = PlayerSetup.Instance._avatar.transform.Find("CrouchLimit"); m_customCrouchLimit = (l_customLimit != null); m_crouchLimit = m_customCrouchLimit ? Mathf.Clamp(l_customLimit.localPosition.y, 0f, 1f) : Settings.CrouchLimit; + + m_ready = true; } public void SetCrouchLimit(float p_value) diff --git a/ml_amt/Properties/AssemblyInfo.cs b/ml_amt/Properties/AssemblyInfo.cs index 5adfeda..f6efc44 100644 --- a/ml_amt/Properties/AssemblyInfo.cs +++ b/ml_amt/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("AvatarMotionTweaker")] -[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] +[assembly: AssemblyVersion("1.0.2")] +[assembly: AssemblyFileVersion("1.0.2")] -[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_amt/resources/menu.js b/ml_amt/resources/menu.js index 825436c..e1a1eb4 100644 --- a/ml_amt/resources/menu.js +++ b/ml_amt/resources/menu.js @@ -102,7 +102,7 @@ function inp_slider_mod_amt(_obj, _callbackName) { // Add own menu { - var l_block = document.createElement('div'); + let l_block = document.createElement('div'); l_block.innerHTML = `

Avatar Motion Tweaker

@@ -115,7 +115,7 @@ function inp_slider_mod_amt(_obj, _callbackName) { document.getElementById('settings-implementation').appendChild(l_block); // Update sliders in new menu block - var l_sliders = l_block.querySelectorAll('.inp_slider'); + let l_sliders = l_block.querySelectorAll('.inp_slider'); for (var i = 0; i < l_sliders.length; i++) { g_modSettingsAMT[g_modSettingsAMT.length] = new inp_slider_mod_amt(l_sliders[i], 'MelonMod_AMT_Call_InpSlider'); } diff --git a/ml_lme/Properties/AssemblyInfo.cs b/ml_lme/Properties/AssemblyInfo.cs index 332745e..5e2034e 100644 --- a/ml_lme/Properties/AssemblyInfo.cs +++ b/ml_lme/Properties/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Reflection; [assembly: AssemblyTitle("LeapMotionExtension")] -[assembly: AssemblyVersion("1.1.3")] -[assembly: AssemblyFileVersion("1.1.3")] +[assembly: AssemblyVersion("1.1.4")] +[assembly: AssemblyFileVersion("1.1.4")] -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_lme/resources/menu.js b/ml_lme/resources/menu.js index a312946..f1c41cb 100644 --- a/ml_lme/resources/menu.js +++ b/ml_lme/resources/menu.js @@ -250,7 +250,7 @@ function inp_dropdown_mod_lme(_obj, _callbackName) { // Add own menu { - var l_block = document.createElement('div'); + let l_block = document.createElement('div'); l_block.innerHTML = `

Leap Motion tracking

@@ -340,21 +340,20 @@ function inp_dropdown_mod_lme(_obj, _callbackName) { document.getElementById('settings-implementation').appendChild(l_block); // Update toggles in new menu block - var l_toggles = l_block.querySelectorAll('.inp_toggle'); + let l_toggles = l_block.querySelectorAll('.inp_toggle'); for (var i = 0; i < l_toggles.length; i++) { g_modSettingsLME[g_modSettingsLME.length] = new inp_toggle_mod_lme(l_toggles[i], 'MelonMod_LME_Call_InpToggle'); } // Update sliders in new menu block - var l_sliders = l_block.querySelectorAll('.inp_slider'); + let l_sliders = l_block.querySelectorAll('.inp_slider'); for (var i = 0; i < l_sliders.length; i++) { g_modSettingsLME[g_modSettingsLME.length] = new inp_slider_mod_lme(l_sliders[i], 'MelonMod_LME_Call_InpSlider'); } //Update dropdowns in new menu block - var l_dropdowns = l_block.querySelectorAll('.inp_dropdown'); + let l_dropdowns = l_block.querySelectorAll('.inp_dropdown'); for (var i = 0; i < l_dropdowns.length; i++) { g_modSettingsLME[g_modSettingsLME.length] = new inp_dropdown_mod_lme(l_dropdowns[i], 'MelonMod_LME_Call_InpDropdown'); } } - diff --git a/ml_mods_cvr.sln b/ml_mods_cvr.sln index 33a8515..dd2eeb3 100644 --- a/ml_mods_cvr.sln +++ b/ml_mods_cvr.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_drs", "ml_drs\ml_drs.csp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_amt", "ml_amt\ml_amt.csproj", "{74E13D02-A506-41A2-A2CF-C8B3D5B1E452}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_sci", "ml_sci\ml_sci.csproj", "{E5481D41-196C-4241-AF26-6595EF1863C1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -39,6 +41,10 @@ Global {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Debug|x64.Build.0 = Debug|x64 {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Release|x64.ActiveCfg = Release|x64 {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Release|x64.Build.0 = Release|x64 + {E5481D41-196C-4241-AF26-6595EF1863C1}.Debug|x64.ActiveCfg = Debug|x64 + {E5481D41-196C-4241-AF26-6595EF1863C1}.Debug|x64.Build.0 = Debug|x64 + {E5481D41-196C-4241-AF26-6595EF1863C1}.Release|x64.ActiveCfg = Release|x64 + {E5481D41-196C-4241-AF26-6595EF1863C1}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ml_sci/.github/img_01.png b/ml_sci/.github/img_01.png new file mode 100644 index 0000000..1d4ce59 Binary files /dev/null and b/ml_sci/.github/img_01.png differ diff --git a/ml_sci/Main.cs b/ml_sci/Main.cs new file mode 100644 index 0000000..a41ca79 --- /dev/null +++ b/ml_sci/Main.cs @@ -0,0 +1,23 @@ +using ABI_RC.Core.UI; +using DarkRift.Client; + +namespace ml_sci +{ + public class ServerConnectionInfo : MelonLoader.MelonMod + { + public override void OnApplicationStart() + { + HarmonyInstance.Patch( + typeof(ABI_RC.Core.Networking.NetworkManager).GetMethod("OnGameNetworkConnectionClosed", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance), + null, + new HarmonyLib.HarmonyMethod(typeof(ServerConnectionInfo).GetMethod(nameof(OnGameNetworkConnectionClosed), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)) + ); + } + + static void OnGameNetworkConnectionClosed(object __0, DisconnectedEventArgs __1) + { + if((CohtmlHud.Instance != null) && (__1 != null) && (!__1.LocalDisconnect)) + CohtmlHud.Instance.ViewDropTextImmediate("(Global) Server", "Connection lost", (__1.Error != System.Net.Sockets.SocketError.Success) ? ("Reason: " + __1.Error.ToString()) : ""); + } + } +} diff --git a/ml_sci/Properties/AssemblyInfo.cs b/ml_sci/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d82a860 --- /dev/null +++ b/ml_sci/Properties/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Reflection; + +[assembly: AssemblyTitle("ServerConnectionInfo")] +[assembly: AssemblyVersion("1.0.0")] +[assembly: AssemblyFileVersion("1.0.0")] + +[assembly: MelonLoader.MelonInfo(typeof(ml_sci.ServerConnectionInfo), "ServerConnectionInfo", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] +[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] \ No newline at end of file diff --git a/ml_sci/README.md b/ml_sci/README.md new file mode 100644 index 0000000..452a888 --- /dev/null +++ b/ml_sci/README.md @@ -0,0 +1,9 @@ +# Server Connection Info +This mod shows HUD notification upon server disconnection. + +![](.github/img_01.png) + +# Installation +* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader) +* Get [latest release DLL](../../../releases/latest): + * Put `ml_sci.dll` in `Mods` folder of game diff --git a/ml_sci/ml_sci.csproj b/ml_sci/ml_sci.csproj new file mode 100644 index 0000000..1e71c50 --- /dev/null +++ b/ml_sci/ml_sci.csproj @@ -0,0 +1,79 @@ + + + + + Debug + AnyCPU + {E5481D41-196C-4241-AF26-6595EF1863C1} + Library + Properties + ml_sci + ml_sci + v4.7.2 + 512 + true + + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + + + + False + F:\games\Steam\common\ChilloutVR\MelonLoader\0Harmony.dll + False + + + False + F:\games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + False + + + False + C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\DarkRift.Client.dll + False + + + False + F:\games\Steam\common\ChilloutVR\MelonLoader\MelonLoader.dll + False + + + + + + + + + + False + False + + + + + + + + + + + + + copy /y "$(TargetPath)" "C:\Games\Steam\common\ChilloutVR\Mods\" + + \ No newline at end of file diff --git a/ml_sci/ml_sci.csproj.user b/ml_sci/ml_sci.csproj.user new file mode 100644 index 0000000..2539084 --- /dev/null +++ b/ml_sci/ml_sci.csproj.user @@ -0,0 +1,6 @@ + + + + C:\Games\Steam\common\ChilloutVR\MelonLoader\;C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\ + + \ No newline at end of file