mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-04 02:49:23 +00:00
Fall damage _(flops)_
This commit is contained in:
parent
9e841cef1c
commit
1c9822dba2
14 changed files with 106 additions and 23 deletions
|
@ -3,13 +3,13 @@ Merged set of MelonLoader mods for ChilloutVR.
|
||||||
**Table for game build 2023r173:**
|
**Table for game build 2023r173:**
|
||||||
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) |
|
| Full name | Short name | Latest version | Available in [CVRMA](https://github.com/knah/CVRMelonAssistant) |
|
||||||
|:---------:|:----------:|:--------------:| :----------------------------------------------------------------|
|
|:---------:|:----------:|:--------------:| :----------------------------------------------------------------|
|
||||||
| [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.3.5 [:arrow_down:](../../releases/latest/download/ml_amt.dll)| ✔ Yes |
|
| [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.3.6 [:arrow_down:](../../releases/latest/download/ml_amt.dll)| ✔ Yes<br>:hourglass: Update review |
|
||||||
| [Avatar Synced Look](/ml_asl/README.md) | ml_asl | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_asl.dll)| :hourglass: On review |
|
| [Avatar Synced Look](/ml_asl/README.md) | ml_asl | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_asl.dll)| ✔ Yes |
|
||||||
| [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.4.5 [:arrow_down:](../../releases/latest/download/ml_lme.dll)| ✔ Yes |
|
| [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.4.5 [:arrow_down:](../../releases/latest/download/ml_lme.dll)| ✔ Yes |
|
||||||
| [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.0.9 [:arrow_down:](../../releases/latest/download/ml_pam.dll)| ✔ Yes |
|
| [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.0.9 [:arrow_down:](../../releases/latest/download/ml_pam.dll)| ✔ Yes |
|
||||||
| [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)| ✔ Yes |
|
| [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)| ✔ Yes |
|
||||||
| [Player Ragdoll Mod](/ml_prm/README.md) | ml_prm | 1.1.1 [:arrow_down:](../../releases/latest/download/ml_prm.dll)| ✔ Yes |
|
| [Player Ragdoll Mod](/ml_prm/README.md) | ml_prm | 1.1.2 [:arrow_down:](../../releases/latest/download/ml_prm.dll)| ✔ Yes<br>:hourglass: Update review |
|
||||||
| [Players Instance Notifier](/ml_pin/README.md) | ml_pin | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)| :hourglass: On review |
|
| [Players Instance Notifier](/ml_pin/README.md) | ml_pin | 1.0.1 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)| ✔ Yes<br>:hourglass: Update review |
|
||||||
| [Vive Extended Input](/ml_vei/README.md) | ml_vei | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_vei.dll)| ✔ Yes |
|
| [Vive Extended Input](/ml_vei/README.md) | ml_vei | 1.0.0 [:arrow_down:](../../releases/latest/download/ml_vei.dll)| ✔ Yes |
|
||||||
|
|
||||||
**Archived mods:**
|
**Archived mods:**
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.3.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.3.6", "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)]
|
||||||
|
|
|
@ -16,7 +16,6 @@ namespace ml_amt
|
||||||
|
|
||||||
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 bool IsGrounded(this MovementSystem p_instance) => (bool)ms_grounded.GetValue(MovementSystem.Instance);
|
|
||||||
public static bool IsGroundedRaw(this MovementSystem p_instance) => (bool)ms_groundedRaw.GetValue(MovementSystem.Instance);
|
public static bool IsGroundedRaw(this MovementSystem p_instance) => (bool)ms_groundedRaw.GetValue(MovementSystem.Instance);
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>AvatarMotionTweaker</Product>
|
<Product>AvatarMotionTweaker</Product>
|
||||||
<PackageId>AvatarMotionTweaker</PackageId>
|
<PackageId>AvatarMotionTweaker</PackageId>
|
||||||
<Version>1.3.5</Version>
|
<Version>1.3.6</Version>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<AssemblyName>ml_amt</AssemblyName>
|
<AssemblyName>ml_amt</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace ml_pin
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
|
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
|
||||||
bool l_notify = true;
|
bool l_notify = false;
|
||||||
|
|
||||||
switch(Settings.NotifyType)
|
switch(Settings.NotifyType)
|
||||||
{
|
{
|
||||||
|
@ -50,13 +50,13 @@ namespace ml_pin
|
||||||
l_notify = false;
|
l_notify = false;
|
||||||
break;
|
break;
|
||||||
case Settings.NotificationType.Friends:
|
case Settings.NotificationType.Friends:
|
||||||
l_notify = (ShouldNotifyInCurrentInstance() && l_isFriend);
|
l_notify = (l_isFriend && ShouldNotifyInCurrentInstance());
|
||||||
break;
|
break;
|
||||||
case Settings.NotificationType.All:
|
case Settings.NotificationType.All:
|
||||||
l_notify = ShouldNotifyInCurrentInstance();
|
l_notify = ShouldNotifyInCurrentInstance();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
l_notify |= (Settings.FriendsAlways && l_isFriend);
|
l_notify |= (l_isFriend && Settings.FriendsAlways);
|
||||||
|
|
||||||
if(l_notify)
|
if(l_notify)
|
||||||
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendJoin : SoundManager.SoundType.PlayerJoin);
|
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendJoin : SoundManager.SoundType.PlayerJoin);
|
||||||
|
@ -71,7 +71,7 @@ namespace ml_pin
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
|
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
|
||||||
bool l_notify = true;
|
bool l_notify = false;
|
||||||
|
|
||||||
switch(Settings.NotifyType)
|
switch(Settings.NotifyType)
|
||||||
{
|
{
|
||||||
|
@ -79,13 +79,13 @@ namespace ml_pin
|
||||||
l_notify = false;
|
l_notify = false;
|
||||||
break;
|
break;
|
||||||
case Settings.NotificationType.Friends:
|
case Settings.NotificationType.Friends:
|
||||||
l_notify = (ShouldNotifyInCurrentInstance() && l_isFriend);
|
l_notify = (l_isFriend && ShouldNotifyInCurrentInstance());
|
||||||
break;
|
break;
|
||||||
case Settings.NotificationType.All:
|
case Settings.NotificationType.All:
|
||||||
l_notify = ShouldNotifyInCurrentInstance();
|
l_notify = ShouldNotifyInCurrentInstance();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
l_notify |= (Settings.FriendsAlways && l_isFriend);
|
l_notify |= (l_isFriend && Settings.FriendsAlways);
|
||||||
|
|
||||||
if(l_notify)
|
if(l_notify)
|
||||||
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendLeave : SoundManager.SoundType.PlayerLeave);
|
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendLeave : SoundManager.SoundType.PlayerLeave);
|
||||||
|
@ -98,9 +98,9 @@ namespace ml_pin
|
||||||
|
|
||||||
bool ShouldNotifyInCurrentInstance()
|
bool ShouldNotifyInCurrentInstance()
|
||||||
{
|
{
|
||||||
bool l_isInPublic = (Settings.NotifyInPublic && MetaPort.Instance.CurrentInstancePrivacy.Contains("Public"));
|
bool l_isInPublic = (MetaPort.Instance.CurrentInstancePrivacy.Contains("Public") && Settings.NotifyInPublic);
|
||||||
bool l_isInFriends = (Settings.NotifyInFriends && MetaPort.Instance.CurrentInstancePrivacy.Contains("Friends"));
|
bool l_isInFriends = (MetaPort.Instance.CurrentInstancePrivacy.Contains("Friends") && Settings.NotifyInFriends);
|
||||||
bool l_isInPrivate = (Settings.NotifyInPrivate && MetaPort.Instance.CurrentInstancePrivacy.Contains("invite"));
|
bool l_isInPrivate = (MetaPort.Instance.CurrentInstancePrivacy.Contains("invite") && Settings.NotifyInPrivate);
|
||||||
return (l_isInPublic || l_isInFriends || l_isInPrivate);
|
return (l_isInPublic || l_isInFriends || l_isInPrivate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "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)]
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<Authors>SDraw</Authors>
|
<Authors>SDraw</Authors>
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>PlayersInstanceNotifier</Product>
|
<Product>PlayersInstanceNotifier</Product>
|
||||||
|
<Version>1.0.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -21,10 +21,12 @@ namespace ml_prm
|
||||||
ViewVelocity,
|
ViewVelocity,
|
||||||
JumpRecover,
|
JumpRecover,
|
||||||
Buoyancy,
|
Buoyancy,
|
||||||
|
FallDamage,
|
||||||
VelocityMultiplier,
|
VelocityMultiplier,
|
||||||
MovementDrag,
|
MovementDrag,
|
||||||
AngularDrag,
|
AngularDrag,
|
||||||
RecoverDelay
|
RecoverDelay,
|
||||||
|
FallLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
static public event Action SwitchChange;
|
static public event Action SwitchChange;
|
||||||
|
@ -85,6 +87,9 @@ namespace ml_prm
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Buoyancy", "Enable buoyancy in fluid volumes. Warning: constantly changes movement and air drag of hips, spine and chest.", Settings.Buoyancy));
|
ms_uiElements.Add(l_modCategory.AddToggle("Buoyancy", "Enable buoyancy in fluid volumes. Warning: constantly changes movement and air drag of hips, spine and chest.", Settings.Buoyancy));
|
||||||
(ms_uiElements[(int)UiIndex.Buoyancy] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Buoyancy, state);
|
(ms_uiElements[(int)UiIndex.Buoyancy] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Buoyancy, state);
|
||||||
|
|
||||||
|
ms_uiElements.Add(l_modCategory.AddToggle("Fall damage", "Enable ragdoll when falling from height", Settings.FallDamage));
|
||||||
|
(ms_uiElements[(int)UiIndex.FallDamage] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.FallDamage, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modRoot.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f));
|
ms_uiElements.Add(l_modRoot.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f));
|
||||||
(ms_uiElements[(int)UiIndex.VelocityMultiplier] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.VelocityMultiplier, value);
|
(ms_uiElements[(int)UiIndex.VelocityMultiplier] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.VelocityMultiplier, value);
|
||||||
|
|
||||||
|
@ -97,6 +102,9 @@ namespace ml_prm
|
||||||
ms_uiElements.Add(l_modRoot.AddSlider("Recover delay (seconds)", "Recover delay for automatic recover", Settings.RecoverDelay, 1f, 10f));
|
ms_uiElements.Add(l_modRoot.AddSlider("Recover delay (seconds)", "Recover delay for automatic recover", Settings.RecoverDelay, 1f, 10f));
|
||||||
(ms_uiElements[(int)UiIndex.RecoverDelay] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.RecoverDelay, value);
|
(ms_uiElements[(int)UiIndex.RecoverDelay] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.RecoverDelay, value);
|
||||||
|
|
||||||
|
ms_uiElements.Add(l_modRoot.AddSlider("Fall limit", "Height limit for fall damage", Settings.FallLimit, 0f, 100f));
|
||||||
|
(ms_uiElements[(int)UiIndex.FallLimit] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.FallLimit, value);
|
||||||
|
|
||||||
l_modCategory.AddButton("Reset settings", "", "Reset mod settings to default").OnPress += Reset;
|
l_modCategory.AddButton("Reset settings", "", "Reset mod settings to default").OnPress += Reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +155,10 @@ namespace ml_prm
|
||||||
case UiIndex.Buoyancy:
|
case UiIndex.Buoyancy:
|
||||||
Settings.SetSetting(Settings.ModSetting.Buoyancy, p_state);
|
Settings.SetSetting(Settings.ModSetting.Buoyancy, p_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case UiIndex.FallDamage:
|
||||||
|
Settings.SetSetting(Settings.ModSetting.FallDamage, p_state);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p_force)
|
if(p_force)
|
||||||
|
@ -172,6 +184,10 @@ namespace ml_prm
|
||||||
case UiIndex.RecoverDelay:
|
case UiIndex.RecoverDelay:
|
||||||
Settings.SetSetting(Settings.ModSetting.RecoverDelay, p_value);
|
Settings.SetSetting(Settings.ModSetting.RecoverDelay, p_value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case UiIndex.FallLimit:
|
||||||
|
Settings.SetSetting(Settings.ModSetting.FallLimit, p_value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p_force)
|
if(p_force)
|
||||||
|
@ -191,10 +207,12 @@ namespace ml_prm
|
||||||
OnToggleUpdate(UiIndex.ViewVelocity, false, true);
|
OnToggleUpdate(UiIndex.ViewVelocity, false, true);
|
||||||
OnToggleUpdate(UiIndex.JumpRecover, false, true);
|
OnToggleUpdate(UiIndex.JumpRecover, false, true);
|
||||||
OnToggleUpdate(UiIndex.Buoyancy, true, true);
|
OnToggleUpdate(UiIndex.Buoyancy, true, true);
|
||||||
|
OnToggleUpdate(UiIndex.FallDamage, true, true);
|
||||||
OnSliderUpdate(UiIndex.VelocityMultiplier, 2f, true);
|
OnSliderUpdate(UiIndex.VelocityMultiplier, 2f, true);
|
||||||
OnSliderUpdate(UiIndex.MovementDrag, 1f, true);
|
OnSliderUpdate(UiIndex.MovementDrag, 1f, true);
|
||||||
OnSliderUpdate(UiIndex.AngularDrag, 1f, true);
|
OnSliderUpdate(UiIndex.AngularDrag, 1f, true);
|
||||||
OnSliderUpdate(UiIndex.RecoverDelay, 3f, true);
|
OnSliderUpdate(UiIndex.RecoverDelay, 3f, true);
|
||||||
|
OnSliderUpdate(UiIndex.FallLimit, 5f, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream GetIconStream(string p_name)
|
static Stream GetIconStream(string p_name)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.2", "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")]
|
||||||
|
|
|
@ -26,8 +26,9 @@ Optional mod's settings page with [BTKUILib](https://github.com/BTK-Development/
|
||||||
* **View direction velocity:** apply velocity to camera view direction instead of player movement direction; `false` by default.
|
* **View direction velocity:** apply velocity to camera view direction instead of player movement direction; `false` by default.
|
||||||
* Note: Forcibly disabled in worlds that don't allow flight.
|
* Note: Forcibly disabled in worlds that don't allow flight.
|
||||||
* **Jump recover:** enables recovering from ragdoll state by jumping; `false` by default.
|
* **Jump recover:** enables recovering from ragdoll state by jumping; `false` by default.
|
||||||
* **Buoyancy:** enabled floating in fluid volumes; `true` by default.
|
* **Buoyancy:** enables floating in fluid volumes; `true` by default.
|
||||||
* Note: Forcibly enabled in worlds that don't allow flight.
|
* Note: Forcibly enabled in worlds that don't allow flight.
|
||||||
|
* **Fall damage:** enables ragdoll when falling from specific height; `true` by default.
|
||||||
* **Velocity multiplier:** velocity force multiplier based on player's movement direction; `2.0` by default.
|
* **Velocity multiplier:** velocity force multiplier based on player's movement direction; `2.0` by default.
|
||||||
* Note: Limited according to world's fly multiplier.
|
* Note: Limited according to world's fly multiplier.
|
||||||
* Note: Forcibly set to `1.0` in worlds that don't allow flight.
|
* Note: Forcibly set to `1.0` in worlds that don't allow flight.
|
||||||
|
@ -35,6 +36,7 @@ Optional mod's settings page with [BTKUILib](https://github.com/BTK-Development/
|
||||||
* Note: Forcibly set to `1.0` in worlds that don't allow flight.
|
* Note: Forcibly set to `1.0` in worlds that don't allow flight.
|
||||||
* **Angular movement drag:** angular movement resistance; `2.0` by default.
|
* **Angular movement drag:** angular movement resistance; `2.0` by default.
|
||||||
* **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.
|
||||||
|
* **Fall limit:** height limit for fall damage; `5.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):
|
Optional mod's settings in [UIExpansionKit](https://github.com/ddakebono/ChilloutMods):
|
||||||
|
|
|
@ -52,6 +52,9 @@ namespace ml_prm
|
||||||
float m_groundedTime = 0f;
|
float m_groundedTime = 0f;
|
||||||
float m_downTime = float.MinValue;
|
float m_downTime = float.MinValue;
|
||||||
|
|
||||||
|
bool m_inAir = false;
|
||||||
|
float m_inAirDistance = 0f;
|
||||||
|
|
||||||
internal RagdollController()
|
internal RagdollController()
|
||||||
{
|
{
|
||||||
m_rigidBodies = new List<Rigidbody>();
|
m_rigidBodies = new List<Rigidbody>();
|
||||||
|
@ -88,6 +91,7 @@ namespace ml_prm
|
||||||
Settings.SlipperinessChange += this.OnPhysicsMaterialChange;
|
Settings.SlipperinessChange += this.OnPhysicsMaterialChange;
|
||||||
Settings.BouncinessChange += this.OnPhysicsMaterialChange;
|
Settings.BouncinessChange += this.OnPhysicsMaterialChange;
|
||||||
Settings.BuoyancyChange += this.OnBuoyancyChange;
|
Settings.BuoyancyChange += this.OnBuoyancyChange;
|
||||||
|
Settings.FallDamageChange += this.OnFallDamageChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
|
@ -124,12 +128,29 @@ namespace ml_prm
|
||||||
Settings.SlipperinessChange -= this.OnPhysicsMaterialChange;
|
Settings.SlipperinessChange -= this.OnPhysicsMaterialChange;
|
||||||
Settings.BouncinessChange -= this.OnPhysicsMaterialChange;
|
Settings.BouncinessChange -= this.OnPhysicsMaterialChange;
|
||||||
Settings.BuoyancyChange -= this.OnBuoyancyChange;
|
Settings.BuoyancyChange -= this.OnBuoyancyChange;
|
||||||
|
Settings.FallDamageChange -= this.OnFallDamageChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if(m_avatarReady && !m_enabled && Settings.FallDamage && !MovementSystem.Instance.flying)
|
||||||
|
{
|
||||||
|
bool l_grounded = MovementSystem.Instance.IsGroundedRaw();
|
||||||
|
if(m_inAir && l_grounded && (m_inAirDistance > Settings.FallLimit))
|
||||||
|
{
|
||||||
|
m_inAirDistance = 0f;
|
||||||
|
SwitchRagdoll();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_inAir = !l_grounded;
|
||||||
|
if(l_grounded)
|
||||||
|
m_inAirDistance = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
if(m_avatarReady && m_enabled)
|
if(m_avatarReady && m_enabled)
|
||||||
{
|
{
|
||||||
|
m_inAirDistance = 0f;
|
||||||
|
|
||||||
Vector3 l_dif = m_puppetReferences.hips.position - m_ragdollLastPos;
|
Vector3 l_dif = m_puppetReferences.hips.position - m_ragdollLastPos;
|
||||||
PlayerSetup.Instance.transform.position += l_dif;
|
PlayerSetup.Instance.transform.position += l_dif;
|
||||||
m_puppetReferences.hips.position -= l_dif;
|
m_puppetReferences.hips.position -= l_dif;
|
||||||
|
@ -142,6 +163,12 @@ namespace ml_prm
|
||||||
{
|
{
|
||||||
Vector3 l_pos = PlayerSetup.Instance.transform.position;
|
Vector3 l_pos = PlayerSetup.Instance.transform.position;
|
||||||
m_velocity = (m_velocity + (l_pos - m_lastPosition) / Time.deltaTime) * 0.5f;
|
m_velocity = (m_velocity + (l_pos - m_lastPosition) / Time.deltaTime) * 0.5f;
|
||||||
|
if(m_inAir)
|
||||||
|
{
|
||||||
|
m_inAirDistance += (m_lastPosition - l_pos).y;
|
||||||
|
m_inAirDistance = Mathf.Clamp(m_inAirDistance, 0f, float.MaxValue);
|
||||||
|
}
|
||||||
|
|
||||||
m_lastPosition = l_pos;
|
m_lastPosition = l_pos;
|
||||||
|
|
||||||
if(!m_reachedGround && MovementSystem.Instance.IsGrounded())
|
if(!m_reachedGround && MovementSystem.Instance.IsGrounded())
|
||||||
|
@ -233,6 +260,8 @@ namespace ml_prm
|
||||||
m_groundedTime = 0f;
|
m_groundedTime = 0f;
|
||||||
m_downTime = float.MinValue;
|
m_downTime = float.MinValue;
|
||||||
m_puppetRoot.localScale = Vector3.one;
|
m_puppetRoot.localScale = Vector3.one;
|
||||||
|
m_inAir = false;
|
||||||
|
m_inAirDistance = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnAvatarSetup()
|
internal void OnAvatarSetup()
|
||||||
|
@ -410,6 +439,7 @@ namespace ml_prm
|
||||||
OnPhysicsMaterialChange(true);
|
OnPhysicsMaterialChange(true);
|
||||||
OnMovementDragChange(Settings.MovementDrag);
|
OnMovementDragChange(Settings.MovementDrag);
|
||||||
OnBuoyancyChange(Settings.Buoyancy);
|
OnBuoyancyChange(Settings.Buoyancy);
|
||||||
|
OnFallDamageChange(Settings.FallDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OnCombatDown()
|
internal void OnCombatDown()
|
||||||
|
@ -425,6 +455,8 @@ namespace ml_prm
|
||||||
|
|
||||||
internal void OnChangeFlight()
|
internal void OnChangeFlight()
|
||||||
{
|
{
|
||||||
|
OnFallDamageChange(Settings.FallDamage);
|
||||||
|
|
||||||
if(m_avatarReady && m_enabled && MovementSystem.Instance.flying)
|
if(m_avatarReady && m_enabled && MovementSystem.Instance.flying)
|
||||||
{
|
{
|
||||||
m_forcedSwitch = true;
|
m_forcedSwitch = true;
|
||||||
|
@ -435,6 +467,8 @@ namespace ml_prm
|
||||||
|
|
||||||
internal void OnPlayerTeleport()
|
internal void OnPlayerTeleport()
|
||||||
{
|
{
|
||||||
|
OnFallDamageChange(Settings.FallDamage);
|
||||||
|
|
||||||
if(m_avatarReady && m_enabled)
|
if(m_avatarReady && m_enabled)
|
||||||
m_ragdollLastPos = m_puppetReferences.hips.position;
|
m_ragdollLastPos = m_puppetReferences.hips.position;
|
||||||
}
|
}
|
||||||
|
@ -530,6 +564,11 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void OnFallDamageChange(bool p_state)
|
||||||
|
{
|
||||||
|
m_inAir = false;
|
||||||
|
m_inAirDistance = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
// Arbitrary
|
// Arbitrary
|
||||||
public void SwitchRagdoll()
|
public void SwitchRagdoll()
|
||||||
|
|
|
@ -23,7 +23,9 @@ namespace ml_prm
|
||||||
Bounciness,
|
Bounciness,
|
||||||
ViewVelocity,
|
ViewVelocity,
|
||||||
JumpRecover,
|
JumpRecover,
|
||||||
Buoyancy
|
Buoyancy,
|
||||||
|
FallDamage,
|
||||||
|
FallLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Hotkey { get; private set; } = true;
|
public static bool Hotkey { get; private set; } = true;
|
||||||
|
@ -42,6 +44,8 @@ namespace ml_prm
|
||||||
public static bool ViewVelocity { get; private set; } = false;
|
public static bool ViewVelocity { get; private set; } = false;
|
||||||
public static bool JumpRecover { get; private set; } = false;
|
public static bool JumpRecover { get; private set; } = false;
|
||||||
public static bool Buoyancy { get; private set; } = true;
|
public static bool Buoyancy { get; private set; } = true;
|
||||||
|
public static bool FallDamage { get; private set; } = true;
|
||||||
|
public static float FallLimit { get; private set; } = 5f;
|
||||||
|
|
||||||
static public event Action<bool> HotkeyChange;
|
static public event Action<bool> HotkeyChange;
|
||||||
static public event Action<KeyCode> HotkeyKeyChange;
|
static public event Action<KeyCode> HotkeyKeyChange;
|
||||||
|
@ -59,6 +63,8 @@ namespace ml_prm
|
||||||
static public event Action<bool> ViewVelocityChange;
|
static public event Action<bool> ViewVelocityChange;
|
||||||
static public event Action<bool> JumpRecoverChange;
|
static public event Action<bool> JumpRecoverChange;
|
||||||
static public event Action<bool> BuoyancyChange;
|
static public event Action<bool> BuoyancyChange;
|
||||||
|
static public event Action<bool> FallDamageChange;
|
||||||
|
static public event Action<float> FallLimitChange;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -85,6 +91,8 @@ namespace ml_prm
|
||||||
ms_category.CreateEntry(ModSetting.ViewVelocity.ToString(), ViewVelocity, null, null, true),
|
ms_category.CreateEntry(ModSetting.ViewVelocity.ToString(), ViewVelocity, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.JumpRecover.ToString(), JumpRecover, null, null, true),
|
ms_category.CreateEntry(ModSetting.JumpRecover.ToString(), JumpRecover, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.Buoyancy.ToString(), Buoyancy, null, null, true),
|
ms_category.CreateEntry(ModSetting.Buoyancy.ToString(), Buoyancy, null, null, true),
|
||||||
|
ms_category.CreateEntry(ModSetting.FallDamage.ToString(), FallDamage, null, null, true),
|
||||||
|
ms_category.CreateEntry(ModSetting.FallLimit.ToString(), FallLimit, null, null, true),
|
||||||
};
|
};
|
||||||
|
|
||||||
ms_entries[(int)ModSetting.HotkeyKey].OnEntryValueChangedUntyped.Subscribe(OnMelonSettingSave_HotkeyKey);
|
ms_entries[(int)ModSetting.HotkeyKey].OnEntryValueChangedUntyped.Subscribe(OnMelonSettingSave_HotkeyKey);
|
||||||
|
@ -105,6 +113,8 @@ namespace ml_prm
|
||||||
ViewVelocity = (bool)ms_entries[(int)ModSetting.ViewVelocity].BoxedValue;
|
ViewVelocity = (bool)ms_entries[(int)ModSetting.ViewVelocity].BoxedValue;
|
||||||
JumpRecover = (bool)ms_entries[(int)ModSetting.JumpRecover].BoxedValue;
|
JumpRecover = (bool)ms_entries[(int)ModSetting.JumpRecover].BoxedValue;
|
||||||
Buoyancy = (bool)ms_entries[(int)ModSetting.Buoyancy].BoxedValue;
|
Buoyancy = (bool)ms_entries[(int)ModSetting.Buoyancy].BoxedValue;
|
||||||
|
FallDamage = (bool)ms_entries[(int)ModSetting.FallDamage].BoxedValue;
|
||||||
|
FallLimit = Mathf.Clamp((float)ms_entries[(int)ModSetting.FallLimit].BoxedValue, 0f, 100f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
|
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
|
||||||
|
@ -198,6 +208,13 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ModSetting.FallDamage:
|
||||||
|
{
|
||||||
|
FallDamage = (bool)p_value;
|
||||||
|
FallDamageChange?.Invoke((bool)p_value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
// Floats
|
// Floats
|
||||||
case ModSetting.VelocityMultiplier:
|
case ModSetting.VelocityMultiplier:
|
||||||
{
|
{
|
||||||
|
@ -226,6 +243,13 @@ namespace ml_prm
|
||||||
RecoverDelayChange?.Invoke((float)p_value);
|
RecoverDelayChange?.Invoke((float)p_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ModSetting.FallLimit:
|
||||||
|
{
|
||||||
|
FallLimit = (float)p_value;
|
||||||
|
FallLimitChange?.Invoke((float)p_value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ms_entries != null)
|
if(ms_entries != null)
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace ml_prm
|
||||||
return l_result;
|
return l_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsGrounded(this MovementSystem p_instance) => (bool)ms_groundedRaw.GetValue(p_instance);
|
public static bool IsGroundedRaw(this MovementSystem p_instance) => (bool)ms_groundedRaw.GetValue(p_instance);
|
||||||
public static Vector3 GetAppliedGravity(this MovementSystem p_instance) => (Vector3)ms_appliedGravity.GetValue(p_instance);
|
public static Vector3 GetAppliedGravity(this MovementSystem p_instance) => (Vector3)ms_appliedGravity.GetValue(p_instance);
|
||||||
public static void SetAppliedGravity(this MovementSystem p_instance, Vector3 p_vec) => ms_appliedGravity.SetValue(p_instance, p_vec);
|
public static void SetAppliedGravity(this MovementSystem p_instance, Vector3 p_vec) => ms_appliedGravity.SetValue(p_instance, p_vec);
|
||||||
public static void ClearFluidVolumes(this MovementSystem p_instance) => (ms_touchingVolumes.GetValue(p_instance) as List<FluidVolume>)?.Clear();
|
public static void ClearFluidVolumes(this MovementSystem p_instance) => (ms_touchingVolumes.GetValue(p_instance) as List<FluidVolume>)?.Clear();
|
||||||
|
|
|
@ -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.1.1</Version>
|
<Version>1.1.2</Version>
|
||||||
<Authors>SDraw</Authors>
|
<Authors>SDraw</Authors>
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>PlayerRagdollMod</Product>
|
<Product>PlayerRagdollMod</Product>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue