Removed jump height

Added changable ragdoll button
Minor edits
This commit is contained in:
SDraw 2023-09-19 11:26:43 +03:00
parent 0fccd9e892
commit 6f9a278694
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
21 changed files with 59 additions and 86 deletions

View file

@ -10,7 +10,7 @@ Merged set of MelonLoader mods for ChilloutVR.
| [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.4.1 [:arrow_down:](../../releases/latest/download/ml_lme.dll)| ✔ Yes | | [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.4.1 [:arrow_down:](../../releases/latest/download/ml_lme.dll)| ✔ Yes |
| [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.0.6 [:arrow_down:](../../releases/latest/download/ml_pam.dll)| ✔ Yes | | [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.0.6 [:arrow_down:](../../releases/latest/download/ml_pam.dll)| ✔ Yes |
| [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.2 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)| ✔ Yes | | [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.2 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)| ✔ Yes |
| [Player Ragdoll Mod](/ml_prm/README.md)| ml_prm | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_prm.dll)| ✔ Yes | | [Player Ragdoll Mod](/ml_prm/README.md)| ml_prm | 1.0.9 [:arrow_down:](../../releases/latest/download/ml_prm.dll)| ✔ Yes<br>:hourglass_flowing_sand: Update review |
| [Game Main Fixes](/ml_gmf/README.md) | ml_gmf | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_gmf.dll)| ❔ No | | [Game Main Fixes](/ml_gmf/README.md) | ml_gmf | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_gmf.dll)| ❔ No |
**Archived mods:** **Archived mods:**

View file

@ -41,9 +41,6 @@ namespace ml_amt
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic)) new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnPlayspaceScale_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
); );
// Overhauls
Overhauls.JumpHeight.Init(HarmonyInstance);
ModSupporter.Init(); ModSupporter.Init();
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer()); MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
} }

View file

@ -2,4 +2,4 @@
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonOptionalDependencies("ml_prm", "ml_pmc")] [assembly: MelonLoader.MelonOptionalDependencies("ml_prm", "ml_pmc")]
[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)]

View file

@ -21,9 +21,6 @@ Available mod's settings in `Settings - IK - Avatar Motion Tweaker`:
* Note: Created as example for [propoused game feature](https://feedback.abinteractive.net/p/disabling-vr-ik-for-emotes-via-animator-state-tag-7b80d963-053a-41c0-86ac-e3d53c61c1e2). * Note: Created as example for [propoused game feature](https://feedback.abinteractive.net/p/disabling-vr-ik-for-emotes-via-animator-state-tag-7b80d963-053a-41c0-86ac-e3d53c61c1e2).
* **Adjusted locomotion mass center:** automatically changes IK locomotion center if avatar has toe bones; default value - `true`. * **Adjusted locomotion mass center:** automatically changes IK locomotion center if avatar has toe bones; default value - `true`.
* Note: Compatible with [DesktopVRIK](https://github.com/NotAKidOnSteam/DesktopVRIK) and [FuckToes](https://github.com/NotAKidOnSteam/FuckToes). * Note: Compatible with [DesktopVRIK](https://github.com/NotAKidOnSteam/DesktopVRIK) and [FuckToes](https://github.com/NotAKidOnSteam/FuckToes).
#### Fixes/overhauls options
* **Scaled locomotion jump:** scales locomotion jump according to relation between your player settings height and current avatar height (includes avatar scale); default value - `false`.
* Note: Disabled in worlds that don't allow flight.
Available additional parameters for AAS animator: Available additional parameters for AAS animator:
* **`Upright`:** defines linear coefficient between current viewpoint height and avatar's viewpoint height; float, range - [0.0, 1.0]. * **`Upright`:** defines linear coefficient between current viewpoint height and avatar's viewpoint height; float, range - [0.0, 1.0].

View file

@ -1,5 +1,4 @@
using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.InteractionSystem;
using cohtml;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -15,7 +14,6 @@ namespace ml_amt
IKOverrideJump, IKOverrideJump,
DetectEmotes, DetectEmotes,
FollowHips, FollowHips,
ScaledJump,
MassCenter MassCenter
}; };
@ -26,7 +24,6 @@ namespace ml_amt
public static bool DetectEmotes { get; private set; } = true; public static bool DetectEmotes { get; private set; } = true;
public static bool FollowHips { get; private set; } = true; public static bool FollowHips { get; private set; } = true;
public static bool MassCenter { get; private set; } = true; public static bool MassCenter { get; private set; } = true;
public static bool ScaledJump { get; private set; } = false;
static MelonLoader.MelonPreferences_Category ms_category = null; static MelonLoader.MelonPreferences_Category ms_category = null;
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null; static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
@ -38,8 +35,6 @@ namespace ml_amt
static public event Action<bool> DetectEmotesChange; static public event Action<bool> DetectEmotesChange;
static public event Action<bool> FollowHipsChange; static public event Action<bool> FollowHipsChange;
static public event Action<bool> MassCenterChange; static public event Action<bool> MassCenterChange;
static public event Action<bool> ScaledJumpChange;
static public event Action<bool> OverrideFixChange;
internal static void Init() internal static void Init()
{ {
@ -53,7 +48,6 @@ namespace ml_amt
ms_category.CreateEntry(ModSetting.IKOverrideJump.ToString(), IKOverrideJump), ms_category.CreateEntry(ModSetting.IKOverrideJump.ToString(), IKOverrideJump),
ms_category.CreateEntry(ModSetting.DetectEmotes.ToString(), DetectEmotes), ms_category.CreateEntry(ModSetting.DetectEmotes.ToString(), DetectEmotes),
ms_category.CreateEntry(ModSetting.FollowHips.ToString(), FollowHips), ms_category.CreateEntry(ModSetting.FollowHips.ToString(), FollowHips),
ms_category.CreateEntry(ModSetting.ScaledJump.ToString(), ScaledJump),
ms_category.CreateEntry(ModSetting.MassCenter.ToString(), MassCenter) ms_category.CreateEntry(ModSetting.MassCenter.ToString(), MassCenter)
}; };
@ -64,7 +58,6 @@ namespace ml_amt
DetectEmotes = (bool)ms_entries[(int)ModSetting.DetectEmotes].BoxedValue; DetectEmotes = (bool)ms_entries[(int)ModSetting.DetectEmotes].BoxedValue;
FollowHips = (bool)ms_entries[(int)ModSetting.FollowHips].BoxedValue; FollowHips = (bool)ms_entries[(int)ModSetting.FollowHips].BoxedValue;
MassCenter = (bool)ms_entries[(int)ModSetting.MassCenter].BoxedValue; MassCenter = (bool)ms_entries[(int)ModSetting.MassCenter].BoxedValue;
ScaledJump = (bool)ms_entries[(int)ModSetting.ScaledJump].BoxedValue;
MelonLoader.MelonCoroutines.Start(WaitMainMenuUi()); MelonLoader.MelonCoroutines.Start(WaitMainMenuUi());
} }
@ -156,13 +149,6 @@ namespace ml_amt
MassCenterChange?.Invoke(MassCenter); MassCenterChange?.Invoke(MassCenter);
} }
break; break;
case ModSetting.ScaledJump:
{
ScaledJump = bool.Parse(p_value);
ScaledJumpChange?.Invoke(ScaledJump);
}
break;
} }
ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value); ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value);

View file

@ -21,13 +21,6 @@ namespace ml_amt
public static bool HasToes(this IKSolverVR p_instance) => (bool)ms_hasToes.GetValue(p_instance); public static bool HasToes(this IKSolverVR p_instance) => (bool)ms_hasToes.GetValue(p_instance);
public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying); public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
public static float GetWorldJumpHeight()
{
float l_result = 1f;
if(CVRWorld.Instance != null)
l_result = CVRWorld.Instance.jumpHeight;
return l_result;
}
public static float GetWorldMovementLimit() public static float GetWorldMovementLimit()
{ {
float l_result = 1f; float l_result = 1f;

View file

@ -228,15 +228,6 @@ function inp_toggle_mod_amt(_obj, _callbackName) {
<div id="MassCenter" class ="inp_toggle no-scroll" data-current="true"></div> <div id="MassCenter" class ="inp_toggle no-scroll" data-current="true"></div>
</div> </div>
</div> </div>
<h4><p style="color: #7F7F7F">Avatar independent game fixes/overhauls</p></h4><br>
<div class ="row-wrapper">
<div class ="option-caption">Scaled locomotion jump: </div>
<div class ="option-input">
<div id="ScaledJump" class ="inp_toggle no-scroll" data-current="false"></div>
</div>
</div>
`; `;
document.getElementById('settings-ik').appendChild(l_block); document.getElementById('settings-ik').appendChild(l_block);

View file

@ -1,6 +1,4 @@
using System.Reflection; [assembly: MelonLoader.MelonInfo(typeof(ml_drs.DesktopReticleSwitch), "DesktopReticleSwitch", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_drs.DesktopReticleSwitch), "DesktopReticleSwitch", "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)]

View file

@ -1,6 +1,4 @@
using System.Reflection; [assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_egn.ExtendedGameNotifications), "ExtendedGameNotifications", "1.0.3", "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)]

View file

@ -1,4 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_gmf.GameMainFixes), "GameMainFixes", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonInfo(typeof(ml_gmf.GameMainFixes), "GameMainFixes", "1.0.0", "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)]

View file

@ -14,4 +14,4 @@ This mod fixes some issues that are present in game
* Fix of animation replacement (chairs, etc.) that leads to broken avatar animator ([feedback post](https://feedback.abinteractive.net/p/gestures-getting-stuck-locally-upon-entering-vehicles-chairs)) * Fix of animation replacement (chairs, etc.) that leads to broken avatar animator ([feedback post](https://feedback.abinteractive.net/p/gestures-getting-stuck-locally-upon-entering-vehicles-chairs))
# Notes # Notes
Some of fixes will be implemented natively in game after 2023r172ex3 All these fixes are implemented natively in 2023r172ex4 build.

View file

@ -20,7 +20,7 @@ namespace ml_lme
foreach(string l_library in ms_libraries) foreach(string l_library in ms_libraries)
{ {
Stream l_libraryStream = l_assembly.GetManifestResourceStream(l_assemblyName + "." + l_library); Stream l_libraryStream = l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + l_library);
if(!File.Exists(l_library)) if(!File.Exists(l_library))
{ {

View file

@ -33,7 +33,7 @@
<EmbeddedResource Include="resources\leapmotion_hands.asset" /> <EmbeddedResource Include="resources\leapmotion_hands.asset" />
<EmbeddedResource Include="resources\menu.js" /> <EmbeddedResource Include="resources\menu.js" />
<EmbeddedResource Include="vendor\LeapSDK\lib\x64\LeapC.dll"> <EmbeddedResource Include="vendor\LeapSDK\lib\x64\LeapC.dll">
<Link>LeapC.dll</Link> <Link>resources/LeapC.dll</Link>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>

View file

@ -1,7 +1,5 @@
using System.Reflection; [assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.0.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPriority(1)] [assembly: MelonLoader.MelonPriority(1)]
[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)]

View file

@ -6,12 +6,8 @@ namespace ml_pam
{ {
static class Utils static class Utils
{ {
static FieldInfo ms_cohtmlView = typeof(CohtmlControlledViewDisposable).GetField("_view", BindingFlags.NonPublic | BindingFlags.Instance);
public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded); public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded);
public static void ExecuteScript(this CohtmlControlledViewDisposable p_instance, string p_script) => ((cohtml.Net.View)ms_cohtmlView.GetValue(p_instance))?.ExecuteScript(p_script);
// Extensions // Extensions
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false) public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
{ {

View file

@ -1,8 +1,6 @@
using System.Reflection; [assembly: MelonLoader.MelonInfo(typeof(ml_pmc.PlayerMovementCopycat), "PlayerMovementCopycat", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_pmc.PlayerMovementCopycat), "PlayerMovementCopycat", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPriority(3)] [assembly: MelonLoader.MelonPriority(3)]
[assembly: MelonLoader.MelonAdditionalDependencies("BTKUILib")] [assembly: MelonLoader.MelonAdditionalDependencies("BTKUILib")]
[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)]

View file

@ -1,7 +1,7 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.0.8", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.0.9", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPriority(2)] [assembly: MelonLoader.MelonPriority(2)]
[assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")] [assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")]
[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)]
[assembly: MelonLoader.MelonAdditionalCredits("kafeijao, NotAKidOnSteam")] [assembly: MelonLoader.MelonAdditionalCredits("kafeijao, NotAKidOnSteam")]

View file

@ -34,6 +34,9 @@ Optional mod's settings page with [BTKUILib](https://github.com/BTK-Development/
* **Recover delay:** time delay for enabled `Auto recover` in seconds; `3.0` by default. * **Recover delay:** time delay for enabled `Auto recover` in seconds; `3.0` by default.
* **Reset settings:** resets mod settings to default. * **Reset settings:** resets mod settings to default.
Optional mod's settings in [UIExpansionKit](https://github.com/ddakebono/ChilloutMods):
* **Hotkey:** system key that is used to switch ragdoll state; `R` by default.
Available additional parameters for AAS animator: Available additional parameters for AAS animator:
* **`Ragdolled`:** defines current ragdoll state; boolean. * **`Ragdolled`:** defines current ragdoll state; boolean.
* Note: Can be set as local-only (not synced) if starts with `#` character. * Note: Can be set as local-only (not synced) if starts with `#` character.

View file

@ -15,6 +15,8 @@ namespace ml_prm
[DisallowMultipleComponent] [DisallowMultipleComponent]
public class RagdollController : MonoBehaviour public class RagdollController : MonoBehaviour
{ {
const float c_defaultFriction = 0.6f;
public static RagdollController Instance { get; private set; } = null; public static RagdollController Instance { get; private set; } = null;
VRIK m_vrIK = null; VRIK m_vrIK = null;
@ -56,8 +58,8 @@ namespace ml_prm
m_jointAnchors = new List<System.Tuple<CharacterJoint, Vector3>>(); m_jointAnchors = new List<System.Tuple<CharacterJoint, Vector3>>();
m_physicsMaterial = new PhysicMaterial("Ragdoll"); m_physicsMaterial = new PhysicMaterial("Ragdoll");
m_physicsMaterial.dynamicFriction = 0.5f; m_physicsMaterial.dynamicFriction = c_defaultFriction;
m_physicsMaterial.staticFriction = 0.5f; m_physicsMaterial.staticFriction = c_defaultFriction;
m_physicsMaterial.frictionCombine = PhysicMaterialCombine.Average; m_physicsMaterial.frictionCombine = PhysicMaterialCombine.Average;
m_physicsMaterial.bounciness = 0f; m_physicsMaterial.bounciness = 0f;
m_physicsMaterial.bounceCombine = PhysicMaterialCombine.Average; m_physicsMaterial.bounceCombine = PhysicMaterialCombine.Average;
@ -145,7 +147,7 @@ namespace ml_prm
if((m_customTrigger != null) && m_customTrigger.GetStateWithReset() && m_avatarReady && !m_enabled && Settings.PointersReaction) if((m_customTrigger != null) && m_customTrigger.GetStateWithReset() && m_avatarReady && !m_enabled && Settings.PointersReaction)
SwitchRagdoll(); SwitchRagdoll();
if(Settings.Hotkey && Input.GetKeyDown(KeyCode.R) && !ViewManager.Instance.isGameMenuOpen()) if(Settings.Hotkey && Input.GetKeyDown(Settings.HotkeyKey) && !ViewManager.Instance.isGameMenuOpen())
SwitchRagdoll(); SwitchRagdoll();
if(m_avatarReady && m_enabled && CVRInputManager.Instance.jump && Settings.JumpRecover) if(m_avatarReady && m_enabled && CVRInputManager.Instance.jump && Settings.JumpRecover)
@ -415,8 +417,8 @@ namespace ml_prm
{ {
bool l_slipperiness = (Settings.Slipperiness && Utils.IsWorldSafe()); bool l_slipperiness = (Settings.Slipperiness && Utils.IsWorldSafe());
bool l_bounciness = (Settings.Bounciness && Utils.IsWorldSafe()); bool l_bounciness = (Settings.Bounciness && Utils.IsWorldSafe());
m_physicsMaterial.dynamicFriction = (l_slipperiness ? 0f : 0.5f); m_physicsMaterial.dynamicFriction = (l_slipperiness ? 0f : c_defaultFriction);
m_physicsMaterial.staticFriction = (l_slipperiness ? 0f : 0.5f); m_physicsMaterial.staticFriction = (l_slipperiness ? 0f : c_defaultFriction);
m_physicsMaterial.frictionCombine = (l_slipperiness ? PhysicMaterialCombine.Minimum : PhysicMaterialCombine.Average); m_physicsMaterial.frictionCombine = (l_slipperiness ? PhysicMaterialCombine.Minimum : PhysicMaterialCombine.Average);
m_physicsMaterial.bounciness = (l_bounciness ? 1f : 0f); m_physicsMaterial.bounciness = (l_bounciness ? 1f : 0f);
m_physicsMaterial.bounceCombine = (l_bounciness ? PhysicMaterialCombine.Maximum : PhysicMaterialCombine.Average); m_physicsMaterial.bounceCombine = (l_bounciness ? PhysicMaterialCombine.Maximum : PhysicMaterialCombine.Average);

View file

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using UnityEngine; using UnityEngine;
namespace ml_prm namespace ml_prm
@ -10,6 +9,7 @@ namespace ml_prm
public enum ModSetting public enum ModSetting
{ {
Hotkey = 0, Hotkey = 0,
HotkeyKey,
VelocityMultiplier, VelocityMultiplier,
MovementDrag, MovementDrag,
AngularDrag, AngularDrag,
@ -26,6 +26,7 @@ namespace ml_prm
} }
public static bool Hotkey { get; private set; } = true; public static bool Hotkey { get; private set; } = true;
public static KeyCode HotkeyKey { get; private set; } = KeyCode.R;
public static float VelocityMultiplier { get; private set; } = 2f; public static float VelocityMultiplier { get; private set; } = 2f;
public static float MovementDrag { get; private set; } = 2f; public static float MovementDrag { get; private set; } = 2f;
public static float AngularDrag { get; private set; } = 2f; public static float AngularDrag { get; private set; } = 2f;
@ -41,6 +42,7 @@ namespace ml_prm
public static bool JumpRecover { get; private set; } = false; public static bool JumpRecover { get; private set; } = false;
static public event Action<bool> HotkeyChange; static public event Action<bool> HotkeyChange;
static public event Action<KeyCode> HotkeyKeyChange;
static public event Action<float> VelocityMultiplierChange; static public event Action<float> VelocityMultiplierChange;
static public event Action<float> MovementDragChange; static public event Action<float> MovementDragChange;
static public event Action<float> AngularDragChange; static public event Action<float> AngularDragChange;
@ -60,26 +62,31 @@ namespace ml_prm
internal static void Init() internal static void Init()
{ {
ms_category = MelonLoader.MelonPreferences.CreateCategory("PRM", null, true); ms_category = MelonLoader.MelonPreferences.CreateCategory("PRM", "Player Ragdoll Mod");
ms_entries = new List<MelonLoader.MelonPreferences_Entry>() ms_entries = new List<MelonLoader.MelonPreferences_Entry>()
{ {
ms_category.CreateEntry(ModSetting.Hotkey.ToString(), Hotkey), ms_category.CreateEntry(ModSetting.Hotkey.ToString(), Hotkey, null, null, true),
ms_category.CreateEntry(ModSetting.VelocityMultiplier.ToString(), VelocityMultiplier), ms_category.CreateEntry(ModSetting.HotkeyKey.ToString(), HotkeyKey, "Hotkey"),
ms_category.CreateEntry(ModSetting.MovementDrag.ToString(), MovementDrag), ms_category.CreateEntry(ModSetting.VelocityMultiplier.ToString(), VelocityMultiplier, null, null, true),
ms_category.CreateEntry(ModSetting.AngularDrag.ToString(), AngularDrag), ms_category.CreateEntry(ModSetting.MovementDrag.ToString(), MovementDrag, null, null, true),
ms_category.CreateEntry(ModSetting.Gravity.ToString(), Gravity), ms_category.CreateEntry(ModSetting.AngularDrag.ToString(), AngularDrag, null, null, true),
ms_category.CreateEntry(ModSetting.PointersReaction.ToString(), PointersReaction), ms_category.CreateEntry(ModSetting.Gravity.ToString(), Gravity, null, null, true),
ms_category.CreateEntry(ModSetting.IgnoreLocal.ToString(), IgnoreLocal), ms_category.CreateEntry(ModSetting.PointersReaction.ToString(), PointersReaction, null, null, true),
ms_category.CreateEntry(ModSetting.CombatReaction.ToString(), CombatReaction), ms_category.CreateEntry(ModSetting.IgnoreLocal.ToString(), IgnoreLocal, null, null, true),
ms_category.CreateEntry(ModSetting.AutoRecover.ToString(), AutoRecover), ms_category.CreateEntry(ModSetting.CombatReaction.ToString(), CombatReaction, null, null, true),
ms_category.CreateEntry(ModSetting.RecoverDelay.ToString(), RecoverDelay), ms_category.CreateEntry(ModSetting.AutoRecover.ToString(), AutoRecover, null, null, true),
ms_category.CreateEntry(ModSetting.Slipperiness.ToString(), Slipperiness), ms_category.CreateEntry(ModSetting.RecoverDelay.ToString(), RecoverDelay, null, null, true),
ms_category.CreateEntry(ModSetting.Bounciness.ToString(), Bounciness), ms_category.CreateEntry(ModSetting.Slipperiness.ToString(), Slipperiness, null, null, true),
ms_category.CreateEntry(ModSetting.ViewVelocity.ToString(), ViewVelocity), ms_category.CreateEntry(ModSetting.Bounciness.ToString(), Bounciness, null, null, true),
ms_category.CreateEntry(ModSetting.JumpRecover.ToString(), JumpRecover) ms_category.CreateEntry(ModSetting.ViewVelocity.ToString(), ViewVelocity, null, null, true),
ms_category.CreateEntry(ModSetting.JumpRecover.ToString(), JumpRecover, null, null, true)
}; };
ms_entries[(int)ModSetting.HotkeyKey].OnEntryValueChangedUntyped.Subscribe(OnMelonSettingSave_HotkeyKey);
Hotkey = (bool)ms_entries[(int)ModSetting.Hotkey].BoxedValue; Hotkey = (bool)ms_entries[(int)ModSetting.Hotkey].BoxedValue;
HotkeyKey = (KeyCode)ms_entries[(int)ModSetting.HotkeyKey].BoxedValue;
VelocityMultiplier = Mathf.Clamp((float)ms_entries[(int)ModSetting.VelocityMultiplier].BoxedValue, 1f, 50f); VelocityMultiplier = Mathf.Clamp((float)ms_entries[(int)ModSetting.VelocityMultiplier].BoxedValue, 1f, 50f);
MovementDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.MovementDrag].BoxedValue, 0f, 50f); MovementDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.MovementDrag].BoxedValue, 0f, 50f);
AngularDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.AngularDrag].BoxedValue, 0f, 50f); AngularDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.AngularDrag].BoxedValue, 0f, 50f);
@ -95,6 +102,15 @@ namespace ml_prm
JumpRecover = (bool)ms_entries[(int)ModSetting.JumpRecover].BoxedValue; JumpRecover = (bool)ms_entries[(int)ModSetting.JumpRecover].BoxedValue;
} }
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
{
if(p_newValue is KeyCode)
{
HotkeyKey = (KeyCode)p_newValue;
HotkeyKeyChange?.Invoke(HotkeyKey);
}
}
public static void SetSetting(ModSetting p_settings, object p_value) public static void SetSetting(ModSetting p_settings, object p_value)
{ {
switch(p_settings) switch(p_settings)

View file

@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<PackageId>PlayerRagdollMod</PackageId> <PackageId>PlayerRagdollMod</PackageId>
<Version>1.0.8</Version> <Version>1.0.9</Version>
<Authors>SDraw</Authors> <Authors>SDraw</Authors>
<Company>None</Company> <Company>None</Company>
<Product>PlayerRagdollMod</Product> <Product>PlayerRagdollMod</Product>