diff --git a/README.md b/README.md index 201dc4b..79904e5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ Merged set of MelonLoader mods for ChilloutVR. -**State table for game build 2022r166:** +**State table for game build 2022r166p1:** | 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 | Pending approval | Working | +| Avatar Motion Tweaker | ml_amt | 1.0.0 | Pending approval | Working | | Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | | Four Point Tracking | ml_fpt | 1.0.1 | Pending approval | Working | -| Leap Motion Extension | ml_lme | 1.1.2 | Pending approval | Working | +| Leap Motion Extension | ml_lme | 1.1.3 | Pending approval | Working | diff --git a/ml_amt/.github/img_02.png b/ml_amt/.github/img_02.png new file mode 100644 index 0000000..d5e1486 Binary files /dev/null and b/ml_amt/.github/img_02.png differ diff --git a/ml_amt/.github/img_03.png b/ml_amt/.github/img_03.png new file mode 100644 index 0000000..898b2ea Binary files /dev/null and b/ml_amt/.github/img_03.png differ diff --git a/ml_amt/.github/img_04.png b/ml_amt/.github/img_04.png new file mode 100644 index 0000000..aca0733 Binary files /dev/null and b/ml_amt/.github/img_04.png differ diff --git a/ml_amt/.github/img_05.png b/ml_amt/.github/img_05.png new file mode 100644 index 0000000..e359c5f Binary files /dev/null and b/ml_amt/.github/img_05.png differ diff --git a/ml_amt/.github/img_06.png b/ml_amt/.github/img_06.png new file mode 100644 index 0000000..02a1515 Binary files /dev/null and b/ml_amt/.github/img_06.png differ diff --git a/ml_amt/.github/img_07.png b/ml_amt/.github/img_07.png new file mode 100644 index 0000000..bf9b3b6 Binary files /dev/null and b/ml_amt/.github/img_07.png differ diff --git a/ml_amt/.github/img_08.png b/ml_amt/.github/img_08.png new file mode 100644 index 0000000..dd4462d Binary files /dev/null and b/ml_amt/.github/img_08.png differ diff --git a/ml_amt/Main.cs b/ml_amt/Main.cs new file mode 100644 index 0000000..8717b1d --- /dev/null +++ b/ml_amt/Main.cs @@ -0,0 +1,61 @@ +using ABI_RC.Core.Player; + +namespace ml_amt +{ + public class AvatarMotionTweaker : MelonLoader.MelonMod + { + static AvatarMotionTweaker ms_instance = null; + + MotionTweaker m_localTweaker = null; + + public override void OnApplicationStart() + { + ms_instance = this; + + Settings.Init(); + Settings.CrouchLimitChange += this.OnCrouchLimitChange; + + HarmonyInstance.Patch( + typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.ClearAvatar)), + null, + new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnAvatarClear_Postfix), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)) + ); + + HarmonyInstance.Patch( + typeof(PlayerSetup).GetMethod(nameof(PlayerSetup.SetupAvatar)), + null, + new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnLocalAvatarSetup_Postfix), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)) + ); + + MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer()); + } + + System.Collections.IEnumerator WaitForLocalPlayer() + { + while(PlayerSetup.Instance == null) + yield return null; + + m_localTweaker = PlayerSetup.Instance.gameObject.AddComponent(); + } + + void OnCrouchLimitChange(float p_value) + { + if(m_localTweaker != null) + m_localTweaker.SetCrouchLimit(p_value); + } + + static void OnLocalAvatarSetup_Postfix() => ms_instance?.OnLocalAvatarSetup(); + void OnLocalAvatarSetup() + { + if((m_localTweaker != null) && !PlayerSetup.Instance._inVr) + m_localTweaker.OnAvatarSetup(); + } + + static void OnAvatarClear_Postfix() => ms_instance?.OnAvatarClear(); + void OnAvatarClear() + { + if(m_localTweaker != null) + m_localTweaker.OnAvatarClear(); + } + } +} diff --git a/ml_amt/MotionTweaker.cs b/ml_amt/MotionTweaker.cs new file mode 100644 index 0000000..2acac50 --- /dev/null +++ b/ml_amt/MotionTweaker.cs @@ -0,0 +1,139 @@ +using ABI_RC.Core.Player; +using System.Collections.Generic; +using UnityEngine; + +namespace ml_amt +{ + class MotionTweaker : MonoBehaviour + { + enum ParameterType + { + Upright + } + enum ParameterSyncType + { + Local, + Synced + } + + struct AdditionalParameterInfo + { + public ParameterType m_type; + public ParameterSyncType m_sync; + public string m_name; + public int m_hash; // For local only + } + + static readonly Vector4 ms_pointVector = new Vector4(0f, 0f, 0f, 1f); + + RootMotion.FinalIK.VRIK m_vrIk = null; + + bool m_standing = true; + float m_currentUpright = 1f; + float m_locomotionWeight = 1f; + float m_crouchLimit = 0.65f; + bool m_customCrouchLimit = false; + + readonly List m_parameters = null; + + public MotionTweaker() + { + m_parameters = new List(); + } + + void Start() + { + if(PlayerSetup.Instance._inVr) + PlayerSetup.Instance.avatarSetupCompleted.AddListener(this.OnAvatarSetup); + } + + 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) + { + 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) + { + switch(l_param.m_type) + { + case ParameterType.Upright: + { + 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; + } + } + } + } + + public void OnAvatarClear() + { + m_vrIk = null; + m_standing = true; + m_parameters.Clear(); + m_locomotionWeight = 1f; + m_crouchLimit = 0.65f; + m_customCrouchLimit = false; + } + + public void OnAvatarSetup() + { + m_vrIk = PlayerSetup.Instance._avatar.GetComponent(); + + // Parse animator parameters + AnimatorControllerParameter[] l_params = PlayerSetup.Instance._animator.parameters; + ParameterType[] l_enumParams = (ParameterType[])System.Enum.GetValues(typeof(ParameterType)); + + foreach(var l_param in l_params) + { + foreach(var l_enumParam in l_enumParams) + { + if(l_param.name.Contains(l_enumParam.ToString()) && (m_parameters.FindIndex(p => p.m_type == l_enumParam) == -1)) + { + bool l_local = (l_param.name[0] == '#'); + + m_parameters.Add(new AdditionalParameterInfo + { + m_type = l_enumParam, + m_sync = (l_local ? ParameterSyncType.Local : ParameterSyncType.Synced), + m_name = l_param.name, + m_hash = (l_local ? l_param.nameHash : 0) + }); + + break; + } + } + } + + 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; + } + + public void SetCrouchLimit(float p_value) + { + if(!m_customCrouchLimit) + m_crouchLimit = Mathf.Clamp(p_value, 0f, 1f); + } + } +} diff --git a/ml_amt/Properties/AssemblyInfo.cs b/ml_amt/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5adfeda --- /dev/null +++ b/ml_amt/Properties/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Reflection; + +[assembly: AssemblyTitle("AvatarMotionTweaker")] +[assembly: AssemblyVersion("1.0.0")] +[assembly: AssemblyFileVersion("1.0.0")] + +[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "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_amt/README.md b/ml_amt/README.md new file mode 100644 index 0000000..9603746 --- /dev/null +++ b/ml_amt/README.md @@ -0,0 +1,38 @@ +# Avatar Motion Tweaker +This mod adds `Upright` parameter for usage in AAS animator and allows disabling legs autostep upon reaching specific `Upright` value. + +![](.github/img_01.png) + +# Installation +* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader) +* Get [latest release DLL](../../../releases/latest): + * Put `ml_amt.dll` in `Mods` folder of game + +# Usage +Available mod's settings in `Settings - Implementation - Avatar Motion Tweaker`: +* **Legs locomotion upright limit:** defines upright limit of legs autostep. If HMD tracking goes below set limit, legs autostep is disabled. Default value - 65. + * Limit can be overrided by avatar. For this avatar has to have child gameobject with name `CrouchLimit` and its Y-axis location will be used as limit, should be in range [0.0, 1.0]. + +Available additional parameters for AAS animator: +* **`Upright`:** defines linear coefficient between current viewpoint height and avatar's viewpoint height. Range - [0.0,1.0] (0.0 - floor, 1.0 - full standing). + * Note: can be set as local-only (not synced) if starts with `#` character. + +## Example of usage in AAS animator for mixed desktop and VR +* To differentiate between desktop and VR players use `CVR Parameter Stream` component on avatar's root gameobject. As example, `InVR` and `InFBT` are boolean typed animator parameters: +![](.github/img_02.png) +* Add additional transitions between standing, crouching and proning blend trees: +![](.github/img_03.png) +* Add conditions for new VR transitions: + * Standing -> Crouching: + ![](.github/img_04.png) + * Crouching -> Standing: + ![](.github/img_05.png) + * Crouching -> Proning: + ![](.github/img_06.png) + * Proning -> Crouching: + ![](.github/img_07.png) +* Add condition check for all desktop transitions: +![](.github/img_08.png) + +# Notes +* Sometimes after restoring legs autostep avatar's torso shakes, currently investigating solution. diff --git a/ml_amt/Scripts.cs b/ml_amt/Scripts.cs new file mode 100644 index 0000000..243c0e6 --- /dev/null +++ b/ml_amt/Scripts.cs @@ -0,0 +1,26 @@ +using System; +using System.IO; +using System.Reflection; + +namespace ml_amt +{ + static class Scripts + { + public static string GetEmbeddedScript(string p_name) + { + string l_result = ""; + Assembly l_assembly = Assembly.GetExecutingAssembly(); + string l_assemblyName = l_assembly.GetName().Name; + + try + { + Stream l_libraryStream = l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + p_name); + StreamReader l_streadReader = new StreamReader(l_libraryStream); + l_result = l_streadReader.ReadToEnd(); + } + catch(Exception) { } + + return l_result; + } + } +} diff --git a/ml_amt/Settings.cs b/ml_amt/Settings.cs new file mode 100644 index 0000000..7484c4a --- /dev/null +++ b/ml_amt/Settings.cs @@ -0,0 +1,83 @@ +using ABI_RC.Core.InteractionSystem; +using cohtml; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace ml_amt +{ + static class Settings + { + enum ModSetting + { + CrouchLimit = 0 + }; + + static float ms_crouchLimit = 0.65f; + + static MelonLoader.MelonPreferences_Category ms_category = null; + static List ms_entries = null; + + static public event Action CrouchLimitChange; + + public static void Init() + { + ms_category = MelonLoader.MelonPreferences.CreateCategory("AMT"); + + ms_entries = new List(); + ms_entries.Add(ms_category.CreateEntry(ModSetting.CrouchLimit.ToString(), 65)); + + Load(); + + MelonLoader.MelonCoroutines.Start(WaitMainMenuUi()); + } + + static System.Collections.IEnumerator WaitMainMenuUi() + { + while(ViewManager.Instance == null) + yield return null; + while(ViewManager.Instance.gameMenuView == null) + yield return null; + while(ViewManager.Instance.gameMenuView.Listener == null) + yield return null; + + ViewManager.Instance.gameMenuView.Listener.ReadyForBindings += () => + { + ViewManager.Instance.gameMenuView.View.BindCall("MelonMod_AMT_Call_InpSlider", new Action(OnSliderUpdate)); + }; + ViewManager.Instance.gameMenuView.Listener.FinishLoad += (_) => + { + ViewManager.Instance.gameMenuView.View.ExecuteScript(Scripts.GetEmbeddedScript("menu.js")); + foreach(var l_entry in ms_entries) + ViewManager.Instance.gameMenuView.View.TriggerEvent("updateModSettingAMT", l_entry.DisplayName, l_entry.GetValueAsString()); + }; + } + + static void Load() + { + ms_crouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f; + } + + static void OnSliderUpdate(string p_name, string p_value) + { + if(Enum.TryParse(p_name, out ModSetting l_setting)) + { + switch(l_setting) + { + case ModSetting.CrouchLimit: + { + ms_crouchLimit = ((int)ms_entries[(int)ModSetting.CrouchLimit].BoxedValue) * 0.01f; + CrouchLimitChange?.Invoke(ms_crouchLimit); + } break; + } + + ms_entries[(int)l_setting].BoxedValue = int.Parse(p_value); + } + } + + public static float CrouchLimit + { + get => ms_crouchLimit; + } + } +} diff --git a/ml_amt/Utils.cs b/ml_amt/Utils.cs new file mode 100644 index 0000000..1a82c71 --- /dev/null +++ b/ml_amt/Utils.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace ml_amt +{ + static class Utils + { + // Extensions + public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false) + { + return Matrix4x4.TRS(p_pos ? p_transform.position : Vector3.zero, p_rot ? p_transform.rotation : Quaternion.identity, p_scl ? p_transform.localScale : Vector3.one); + } + } +} diff --git a/ml_amt/ml_amt.csproj b/ml_amt/ml_amt.csproj new file mode 100644 index 0000000..777a58a --- /dev/null +++ b/ml_amt/ml_amt.csproj @@ -0,0 +1,87 @@ + + + + + Debug + AnyCPU + {74E13D02-A506-41A2-A2CF-C8B3D5B1E452} + Library + Properties + ml_amt + ml_amt + 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 + + + False + False + + + False + C:\Games\Steam\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll + False + + + False + + + False + + + False + False + + + + + + + + + + False + False + + + False + + + + + + + + + + + + + + + + copy /y "$(TargetPath)" "C:\Games\Steam\common\ChilloutVR\Mods\" + + \ No newline at end of file diff --git a/ml_amt/ml_amt.csproj.user b/ml_amt/ml_amt.csproj.user new file mode 100644 index 0000000..2539084 --- /dev/null +++ b/ml_amt/ml_amt.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 diff --git a/ml_amt/resources/menu.js b/ml_amt/resources/menu.js new file mode 100644 index 0000000..825436c --- /dev/null +++ b/ml_amt/resources/menu.js @@ -0,0 +1,122 @@ +// Add settings +var g_modSettingsAMT = []; + +engine.on('updateModSettingAMT', function (_name, _value) { + for (var i = 0; i < g_modSettingsAMT.length; i++) { + if (g_modSettingsAMT[i].name == _name) { + g_modSettingsAMT[i].updateValue(_value); + break; + } + } +}); + +// Modified from original `inp` types, because I have no js knowledge to hook stuff +function inp_slider_mod_amt(_obj, _callbackName) { + this.obj = _obj; + this.callbackName = _callbackName; + this.minValue = parseFloat(_obj.getAttribute('data-min')); + this.maxValue = parseFloat(_obj.getAttribute('data-max')); + this.percent = 0; + this.value = parseFloat(_obj.getAttribute('data-current')); + this.dragActive = false; + this.name = _obj.id; + this.type = _obj.getAttribute('data-type'); + this.caption = _obj.getAttribute('data-caption'); + + var self = this; + + this.valueBar = document.createElement('div'); + this.valueBar.className = 'valueBar'; + this.valueBar.setAttribute('style', 'width: ' + (((this.value - this.minValue) / (this.maxValue - this.minValue)) * 100) + '%;'); + this.obj.appendChild(this.valueBar); + + this.valueLabel = document.createElement('div'); + this.valueLabel.className = 'valueLabel'; + this.valueLabel.innerHTML = this.caption + Math.round(this.value); + this.obj.appendChild(this.valueLabel); + + this.mouseDown = function (_e) { + self.dragActive = true; + self.mouseMove(_e, false); + } + + this.mouseMove = function (_e, _write) { + if (self.dragActive) { + var rect = _obj.getBoundingClientRect(); + var start = rect.left; + var end = rect.right; + self.percent = Math.min(Math.max((_e.clientX - start) / rect.width, 0), 1); + var value = self.percent; + value *= (self.maxValue - self.minValue); + value += self.minValue; + self.value = Math.round(value); + + self.valueBar.setAttribute('style', 'width: ' + (self.percent * 100) + '%;'); + self.valueLabel.innerHTML = self.caption + self.value; + + engine.call(self.callbackName, self.name, "" + self.value); + self.displayImperial(); + } + } + + this.mouseUp = function (_e) { + self.mouseMove(_e, true); + self.dragActive = false; + } + + _obj.addEventListener('mousedown', this.mouseDown); + document.addEventListener('mousemove', this.mouseMove); + document.addEventListener('mouseup', this.mouseUp); + + this.getValue = function () { + return self.value; + } + + this.updateValue = function (value) { + self.value = Math.round(value); + self.percent = (self.value - self.minValue) / (self.maxValue - self.minValue); + self.valueBar.setAttribute('style', 'width: ' + (self.percent * 100) + '%;'); + self.valueLabel.innerHTML = self.caption + self.value; + self.displayImperial(); + } + + this.displayImperial = function () { + var displays = document.querySelectorAll('.imperialDisplay'); + for (var i = 0; i < displays.length; i++) { + var binding = displays[i].getAttribute('data-binding'); + if (binding == self.name) { + var realFeet = ((self.value * 0.393700) / 12); + var feet = Math.floor(realFeet); + var inches = Math.floor((realFeet - feet) * 12); + displays[i].innerHTML = feet + "'" + inches + ''''; + } + } + } + + return { + name: this.name, + value: this.getValue, + updateValue: this.updateValue + } +} + +// Add own menu +{ + var l_block = document.createElement('div'); + l_block.innerHTML = ` +

Avatar Motion Tweaker

+
+
Legs locomotion upright limit:
+
+
+
+
+ `; + document.getElementById('settings-implementation').appendChild(l_block); + + // Update sliders in new menu block + var 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 1be5d69..332745e 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.2")] -[assembly: AssemblyFileVersion("1.1.2")] +[assembly: AssemblyVersion("1.1.3")] +[assembly: AssemblyFileVersion("1.1.3")] -[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.1.3", "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/Settings.cs b/ml_lme/Settings.cs index 23bf739..d5c291b 100644 --- a/ml_lme/Settings.cs +++ b/ml_lme/Settings.cs @@ -94,7 +94,7 @@ namespace ml_lme { ViewManager.Instance.gameMenuView.View.ExecuteScript(Scripts.GetEmbeddedScript("menu.js")); foreach(var l_entry in ms_entries) - ViewManager.Instance.gameMenuView.View.TriggerEvent("updateModSetting", l_entry.DisplayName, l_entry.GetValueAsString()); + ViewManager.Instance.gameMenuView.View.TriggerEvent("updateModSettingLME", l_entry.DisplayName, l_entry.GetValueAsString()); }; } diff --git a/ml_lme/ml_lme.csproj b/ml_lme/ml_lme.csproj index 9b50b5d..a32cd22 100644 --- a/ml_lme/ml_lme.csproj +++ b/ml_lme/ml_lme.csproj @@ -137,6 +137,6 @@ - copy /y "$(TargetPath)" "C:\Games\Steam\common\ChilloutVR\Mods\ + copy /y "$(TargetPath)" "C:\Games\Steam\common\ChilloutVR\Mods\" \ No newline at end of file diff --git a/ml_lme/resources/menu.js b/ml_lme/resources/menu.js index 5fc6753..a312946 100644 --- a/ml_lme/resources/menu.js +++ b/ml_lme/resources/menu.js @@ -1,17 +1,17 @@ // Add settings -var g_modSettings = []; +var g_modSettingsLME = []; -engine.on('updateModSetting', function (_name, _value) { - for (var i = 0; i < g_modSettings.length; i++) { - if (g_modSettings[i].name == _name) { - g_modSettings[i].updateValue(_value); +engine.on('updateModSettingLME', function (_name, _value) { + for (var i = 0; i < g_modSettingsLME.length; i++) { + if (g_modSettingsLME[i].name == _name) { + g_modSettingsLME[i].updateValue(_value); break; } } }); // Modified from original `inp` types, because I have no js knowledge to hook stuff -function inp_toggle_mod(_obj, _callbackName) { +function inp_toggle_mod_lme(_obj, _callbackName) { this.obj = _obj; this.callbackName = _callbackName; this.value = _obj.getAttribute('data-current'); @@ -58,7 +58,7 @@ function inp_toggle_mod(_obj, _callbackName) { } } -function inp_slider_mod(_obj, _callbackName) { +function inp_slider_mod_lme(_obj, _callbackName) { this.obj = _obj; this.callbackName = _callbackName; this.minValue = parseFloat(_obj.getAttribute('data-min')); @@ -147,7 +147,7 @@ function inp_slider_mod(_obj, _callbackName) { } } -function inp_dropdown_mod(_obj, _callbackName) { +function inp_dropdown_mod_lme(_obj, _callbackName) { this.obj = _obj; this.callbackName = _callbackName; this.value = _obj.getAttribute('data-current'); @@ -342,19 +342,19 @@ function inp_dropdown_mod(_obj, _callbackName) { // Update toggles in new menu block var l_toggles = l_block.querySelectorAll('.inp_toggle'); for (var i = 0; i < l_toggles.length; i++) { - g_modSettings[g_modSettings.length] = new inp_toggle_mod(l_toggles[i], 'MelonMod_LME_Call_InpToggle'); + 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'); for (var i = 0; i < l_sliders.length; i++) { - g_modSettings[g_modSettings.length] = new inp_slider_mod(l_sliders[i], 'MelonMod_LME_Call_InpSlider'); + 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'); for (var i = 0; i < l_dropdowns.length; i++) { - g_modSettings[g_modSettings.length] = new inp_dropdown_mod(l_dropdowns[i], 'MelonMod_LME_Call_InpDropdown'); + 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 f687b16..33a8515 100644 --- a/ml_mods_cvr.sln +++ b/ml_mods_cvr.sln @@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_aci", "ml_aci\ml_aci.csp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_drs", "ml_drs\ml_drs.csproj", "{06CD5155-4459-48C3-8A53-E0B91136351B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_aap", "ml_aap\ml_aap.csproj", "{96D1D71A-23A4-4A0F-9736-25E711BA48F9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ml_amt", "ml_amt\ml_amt.csproj", "{74E13D02-A506-41A2-A2CF-C8B3D5B1E452}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -35,10 +35,10 @@ Global {06CD5155-4459-48C3-8A53-E0B91136351B}.Debug|x64.Build.0 = Debug|x64 {06CD5155-4459-48C3-8A53-E0B91136351B}.Release|x64.ActiveCfg = Release|x64 {06CD5155-4459-48C3-8A53-E0B91136351B}.Release|x64.Build.0 = Release|x64 - {96D1D71A-23A4-4A0F-9736-25E711BA48F9}.Debug|x64.ActiveCfg = Debug|x64 - {96D1D71A-23A4-4A0F-9736-25E711BA48F9}.Debug|x64.Build.0 = Debug|x64 - {96D1D71A-23A4-4A0F-9736-25E711BA48F9}.Release|x64.ActiveCfg = Release|x64 - {96D1D71A-23A4-4A0F-9736-25E711BA48F9}.Release|x64.Build.0 = Release|x64 + {74E13D02-A506-41A2-A2CF-C8B3D5B1E452}.Debug|x64.ActiveCfg = Debug|x64 + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE