mirror of
https://github.com/SDraw/ml_mods_cvr.git
synced 2026-05-03 17:07:00 +00:00
PRM fix for build 2026r181
This commit is contained in:
parent
49987b5d72
commit
e357f83227
9 changed files with 88 additions and 142 deletions
23
README.md
23
README.md
|
|
@ -1,23 +0,0 @@
|
||||||
Merged set of MelonLoader mods for ChilloutVR.
|
|
||||||
|
|
||||||
**Table for game build 2025r181:**
|
|
||||||
| Full name | Latest version |
|
|
||||||
|:---------:|:--------------:|
|
|
||||||
|[Avatar Motion Tweaker](/ml_amt/README.md)|1.5.3 [:arrow_down:](../../releases/download/r181/AvatarMotionTweaker.dll)|
|
|
||||||
|[Avatar Synced Look](/ml_asl/README.md)|1.1.4 [:arrow_down:](../../releases/download/r181/AvatarSyncedLook.dll)|
|
|
||||||
|[Better Fingers Tracking](/ml_bft/README.md)|1.1.4 [:arrow_down:](../../releases/download/r181/BetterFingersTracking.dll)|
|
|
||||||
|[Leap Motion Extension](/ml_lme/README.md)| 1.6.4 [:arrow_down:](../../releases/download/r181/LeapMotionExtension.dll)|
|
|
||||||
|[Pickup Arm Movement](/ml_pam/README.md)|1.2.4 [:arrow_down:](../../releases/download/r181/PickupArmMovement.dll)|
|
|
||||||
|[Player Avatar History](/ml_pah/README.md)|1.0.1 [:arrow_down:](../../releases/download/r181/PlayerAvatarHistory.dll)|
|
|
||||||
|[Player Movement Copycat](/ml_pmc/README.md)|1.1.3 [:arrow_down:](../../releases/download/r181/PlayerMovementCopycat.dll)|
|
|
||||||
|[Player Pick Up](/ml_ppu/README.md)|1.0.2 [:arrow_down:](../../releases/download/r181/PlayerPickUp.dll)|
|
|
||||||
|[Player Ragdoll Mod](/ml_prm/README.md)|1.2.5 [:arrow_down:](../../releases/download/r181/PlayerRagdollMod.dll)|
|
|
||||||
|[Players Instance Notifier](/ml_pin/README.md)|1.1.3 [:arrow_down:](../../releases/download/r181/PlayersInstanceNotifier.dll)|
|
|
||||||
|[Vive Extended Input](/ml_vei/README.md)|1.1.3 [:arrow_down:](../../releases/download/r181/ViveExtendedInput.dll)|
|
|
||||||
|[Video Player Cookies](/ml_vpc/README.md)|1.0.4 [:arrow_down:](../../releases/download/r181/VideoPlayerCookies.dll)|
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace ml_prm
|
||||||
);
|
);
|
||||||
|
|
||||||
p_instance.Patch(
|
p_instance.Patch(
|
||||||
typeof(PlayerSetup).GetMethod("SetupIKScaling", BindingFlags.Instance |BindingFlags.NonPublic),
|
typeof(PlayerSetup).GetMethod("SetupIKScaling", BindingFlags.Instance | BindingFlags.NonPublic),
|
||||||
null,
|
null,
|
||||||
new HarmonyLib.HarmonyMethod(typeof(GameEvents).GetMethod(nameof(OnSetupIKScaling_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
new HarmonyLib.HarmonyMethod(typeof(GameEvents).GetMethod(nameof(OnSetupIKScaling_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
);
|
);
|
||||||
|
|
@ -73,7 +73,7 @@ namespace ml_prm
|
||||||
);
|
);
|
||||||
|
|
||||||
p_instance.Patch(
|
p_instance.Patch(
|
||||||
typeof(RootLogic).GetMethod(nameof(RootLogic.SpawnOnWorldInstance),BindingFlags.Instance | BindingFlags.Public),
|
typeof(RootLogic).GetMethod(nameof(RootLogic.SpawnOnWorldInstance), BindingFlags.Instance | BindingFlags.Public),
|
||||||
new HarmonyLib.HarmonyMethod(typeof(GameEvents).GetMethod(nameof(OnWorldSpawn_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
new HarmonyLib.HarmonyMethod(typeof(GameEvents).GetMethod(nameof(OnWorldSpawn_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ namespace ml_prm
|
||||||
Hotkey = 0,
|
Hotkey = 0,
|
||||||
Gravity,
|
Gravity,
|
||||||
PointersReaction,
|
PointersReaction,
|
||||||
IgnoreLocal,
|
|
||||||
CombatReaction,
|
CombatReaction,
|
||||||
AutoRecover,
|
AutoRecover,
|
||||||
Slipperiness,
|
Slipperiness,
|
||||||
|
|
@ -35,8 +34,7 @@ namespace ml_prm
|
||||||
AngularDrag,
|
AngularDrag,
|
||||||
RecoverDelay,
|
RecoverDelay,
|
||||||
FallLimit,
|
FallLimit,
|
||||||
GestureGrab,
|
GestureGrab
|
||||||
FriendsGrab
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const string c_ragdollKeyTooltip = "Switch ragdoll mode with '{0}' key";
|
const string c_ragdollKeyTooltip = "Switch ragdoll mode with '{0}' key";
|
||||||
|
|
@ -52,7 +50,6 @@ namespace ml_prm
|
||||||
static ToggleButton ms_hotkeyToggle = null;
|
static ToggleButton ms_hotkeyToggle = null;
|
||||||
static ToggleButton ms_gravityToggle = null;
|
static ToggleButton ms_gravityToggle = null;
|
||||||
static ToggleButton ms_pointersToggle = null;
|
static ToggleButton ms_pointersToggle = null;
|
||||||
static ToggleButton ms_ignoreLocalToggle = null;
|
|
||||||
static ToggleButton ms_combatToggle = null;
|
static ToggleButton ms_combatToggle = null;
|
||||||
static ToggleButton ms_recoveryToggle = null;
|
static ToggleButton ms_recoveryToggle = null;
|
||||||
static ToggleButton ms_slipperinessToggle = null;
|
static ToggleButton ms_slipperinessToggle = null;
|
||||||
|
|
@ -62,7 +59,6 @@ namespace ml_prm
|
||||||
static ToggleButton ms_buoyancyToggle = null;
|
static ToggleButton ms_buoyancyToggle = null;
|
||||||
static ToggleButton ms_fallDamageToggle = null;
|
static ToggleButton ms_fallDamageToggle = null;
|
||||||
static ToggleButton ms_gestureGrabToggle = null;
|
static ToggleButton ms_gestureGrabToggle = null;
|
||||||
static ToggleButton ms_friendsGrabToggle = null;
|
|
||||||
static SliderFloat ms_velocityMultiplierSlider = null;
|
static SliderFloat ms_velocityMultiplierSlider = null;
|
||||||
static SliderFloat ms_movementDragSlider = null;
|
static SliderFloat ms_movementDragSlider = null;
|
||||||
static SliderFloat ms_angularMovementDragSlider = null;
|
static SliderFloat ms_angularMovementDragSlider = null;
|
||||||
|
|
@ -94,9 +90,6 @@ namespace ml_prm
|
||||||
ms_pointersToggle = ms_category.AddToggle("Pointers reaction", "React to trigger colliders with CVRPointer component of 'ragdoll' type", Settings.PointersReaction);
|
ms_pointersToggle = ms_category.AddToggle("Pointers reaction", "React to trigger colliders with CVRPointer component of 'ragdoll' type", Settings.PointersReaction);
|
||||||
ms_pointersToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.PointersReaction, state);
|
ms_pointersToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.PointersReaction, state);
|
||||||
|
|
||||||
ms_ignoreLocalToggle = ms_category.AddToggle("Ignore local pointers", "Ignore local avatar's CVRPointer components of 'ragdoll' type", Settings.IgnoreLocal);
|
|
||||||
ms_ignoreLocalToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.IgnoreLocal, state);
|
|
||||||
|
|
||||||
ms_combatToggle = ms_category.AddToggle("Combat reaction", "Ragdoll upon combat system death", Settings.CombatReaction);
|
ms_combatToggle = ms_category.AddToggle("Combat reaction", "Ragdoll upon combat system death", Settings.CombatReaction);
|
||||||
ms_combatToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.CombatReaction, state);
|
ms_combatToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.CombatReaction, state);
|
||||||
|
|
||||||
|
|
@ -121,12 +114,9 @@ namespace ml_prm
|
||||||
ms_fallDamageToggle = ms_category.AddToggle("Fall damage", "Enable ragdoll when falling from height", Settings.FallDamage);
|
ms_fallDamageToggle = ms_category.AddToggle("Fall damage", "Enable ragdoll when falling from height", Settings.FallDamage);
|
||||||
ms_fallDamageToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.FallDamage, state);
|
ms_fallDamageToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.FallDamage, state);
|
||||||
|
|
||||||
ms_gestureGrabToggle = ms_category.AddToggle("Gesture grab", "Enable grabbing of ragdolled body parts by remote players with trigger/grab gesture<p>Warning: can lead to unpredictable physics behaviour in some cases", Settings.GestureGrab);
|
ms_gestureGrabToggle = ms_category.AddToggle("Grab attaching", "Enable attaching of ragdolled body parts to pointers of 'grab' type<p>Warning: can lead to unpredictable physics behaviour in some cases", Settings.GestureGrab);
|
||||||
ms_gestureGrabToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.GestureGrab, state);
|
ms_gestureGrabToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.GestureGrab, state);
|
||||||
|
|
||||||
ms_friendsGrabToggle = ms_category.AddToggle("Friends grab only", " ", Settings.FriendsGrab);
|
|
||||||
ms_friendsGrabToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.FriendsGrab, state);
|
|
||||||
|
|
||||||
ms_velocityMultiplierSlider = ms_category.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f);
|
ms_velocityMultiplierSlider = ms_category.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f);
|
||||||
ms_velocityMultiplierSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.VelocityMultiplier, value);
|
ms_velocityMultiplierSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.VelocityMultiplier, value);
|
||||||
|
|
||||||
|
|
@ -177,10 +167,6 @@ namespace ml_prm
|
||||||
Settings.SetSetting(Settings.ModSetting.PointersReaction, p_state);
|
Settings.SetSetting(Settings.ModSetting.PointersReaction, p_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UiIndex.IgnoreLocal:
|
|
||||||
Settings.SetSetting(Settings.ModSetting.IgnoreLocal, p_state);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UiIndex.CombatReaction:
|
case UiIndex.CombatReaction:
|
||||||
Settings.SetSetting(Settings.ModSetting.CombatReaction, p_state);
|
Settings.SetSetting(Settings.ModSetting.CombatReaction, p_state);
|
||||||
break;
|
break;
|
||||||
|
|
@ -216,10 +202,6 @@ namespace ml_prm
|
||||||
case UiIndex.GestureGrab:
|
case UiIndex.GestureGrab:
|
||||||
Settings.SetSetting(Settings.ModSetting.GestureGrab, p_state);
|
Settings.SetSetting(Settings.ModSetting.GestureGrab, p_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UiIndex.FriendsGrab:
|
|
||||||
Settings.SetSetting(Settings.ModSetting.FriendsGrab, p_state);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
|
@ -275,9 +257,6 @@ namespace ml_prm
|
||||||
OnToggleUpdate(UiIndex.PointersReaction, true);
|
OnToggleUpdate(UiIndex.PointersReaction, true);
|
||||||
ms_pointersToggle.ToggleValue = true;
|
ms_pointersToggle.ToggleValue = true;
|
||||||
|
|
||||||
OnToggleUpdate(UiIndex.IgnoreLocal, true);
|
|
||||||
ms_ignoreLocalToggle.ToggleValue = true;
|
|
||||||
|
|
||||||
OnToggleUpdate(UiIndex.CombatReaction, true);
|
OnToggleUpdate(UiIndex.CombatReaction, true);
|
||||||
ms_combatToggle.ToggleValue = true;
|
ms_combatToggle.ToggleValue = true;
|
||||||
|
|
||||||
|
|
@ -305,9 +284,6 @@ namespace ml_prm
|
||||||
OnToggleUpdate(UiIndex.GestureGrab, false);
|
OnToggleUpdate(UiIndex.GestureGrab, false);
|
||||||
ms_gestureGrabToggle.ToggleValue = false;
|
ms_gestureGrabToggle.ToggleValue = false;
|
||||||
|
|
||||||
OnToggleUpdate(UiIndex.FriendsGrab, true);
|
|
||||||
ms_friendsGrabToggle.ToggleValue = true;
|
|
||||||
|
|
||||||
OnSliderUpdate(UiIndex.VelocityMultiplier, 2f);
|
OnSliderUpdate(UiIndex.VelocityMultiplier, 2f);
|
||||||
ms_velocityMultiplierSlider.SetSliderValue(2f);
|
ms_velocityMultiplierSlider.SetSliderValue(2f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.2.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.2.6", "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.MelonAdditionalDependencies("BTKUILib")]
|
[assembly: MelonLoader.MelonAdditionalDependencies("BTKUILib")]
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
using ABI.CCK.Components;
|
using ABI.CCK.Components;
|
||||||
using ABI_RC.Core;
|
using ABI_RC.Core;
|
||||||
using ABI_RC.Core.Networking.IO.Social;
|
|
||||||
using ABI_RC.Core.Player;
|
using ABI_RC.Core.Player;
|
||||||
using ABI_RC.Core.Savior;
|
|
||||||
using ABI_RC.Systems.Movement;
|
using ABI_RC.Systems.Movement;
|
||||||
|
using NAK.Contacts;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ml_prm
|
namespace ml_prm
|
||||||
{
|
{
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
class RagdollBodypartHandler : MonoBehaviour, CVRTriggerVolume
|
class RagdollBodypartHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
const string c_ragdollPointerType = "ragdoll";
|
const string c_ragdollPointerType = "ragdoll";
|
||||||
const string c_grabPointerType = "grab";
|
const string c_grabPointerType = "grab";
|
||||||
|
|
@ -18,14 +18,16 @@ namespace ml_prm
|
||||||
|
|
||||||
Rigidbody m_rigidBody = null;
|
Rigidbody m_rigidBody = null;
|
||||||
public Collider collider { get; set; } = null;
|
public Collider collider { get; set; } = null;
|
||||||
|
ContactReceiver m_contactReciever = null;
|
||||||
|
|
||||||
PhysicsInfluencer m_physicsInfluencer = null;
|
PhysicsInfluencer m_physicsInfluencer = null;
|
||||||
public bool UseBuoyancy { get; set; } = false;
|
public bool UseBuoyancy { get; set; } = false;
|
||||||
|
|
||||||
bool m_attached = false;
|
bool m_attached = false;
|
||||||
CVRPointer m_attachedPointer = null;
|
|
||||||
Transform m_attachTransform = null;
|
Transform m_attachTransform = null;
|
||||||
|
ContactSender m_attachedSender = null;
|
||||||
FixedJoint m_attachJoint = null;
|
FixedJoint m_attachJoint = null;
|
||||||
|
static List<ContactSender> ms_attachedSenders = new List<ContactSender>();
|
||||||
|
|
||||||
// Unity events
|
// Unity events
|
||||||
void Awake()
|
void Awake()
|
||||||
|
|
@ -42,7 +44,28 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
|
|
||||||
if(collider != null)
|
if(collider != null)
|
||||||
|
{
|
||||||
RemoveGameCollision();
|
RemoveGameCollision();
|
||||||
|
|
||||||
|
var l_constactShape = ContactConversion.FromCollider(collider, true);
|
||||||
|
m_contactReciever = this.gameObject.AddComponent<ContactReceiver>();
|
||||||
|
|
||||||
|
m_contactReciever.shapeType = l_constactShape.shapeType;
|
||||||
|
m_contactReciever.localPosition = l_constactShape.localPosition;
|
||||||
|
m_contactReciever.localRotation = l_constactShape.localRotation;
|
||||||
|
m_contactReciever.radius = l_constactShape.radius;
|
||||||
|
m_contactReciever.height = l_constactShape.height;
|
||||||
|
m_contactReciever.boxSize = l_constactShape.boxSize;
|
||||||
|
|
||||||
|
m_contactReciever.collisionTags = new string[] { c_ragdollPointerType, c_grabPointerType };
|
||||||
|
m_contactReciever.receiverType = ReceiverType.Constant;
|
||||||
|
m_contactReciever.contentTypes = ContentType.World | ContentType.Avatar | ContentType.Prop;
|
||||||
|
m_contactReciever.SourceContentType = ContentType.Player;
|
||||||
|
m_contactReciever.contactValue = 1f;
|
||||||
|
m_contactReciever.drawGizmos = false;
|
||||||
|
|
||||||
|
m_contactReciever.OnContactEnter += this.OnContactEnter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
|
|
@ -64,46 +87,45 @@ namespace ml_prm
|
||||||
|
|
||||||
this.gameObject.name = string.Format("{0} [NoGizmo]", this.gameObject.name);
|
this.gameObject.name = string.Format("{0} [NoGizmo]", this.gameObject.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(collider != null)
|
|
||||||
{
|
|
||||||
CVRParticlePointerManager.volumes.Add(this);
|
|
||||||
CVRParticlePointerManager.UpdateParticleSystems();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
if(collider != null)
|
|
||||||
CVRParticlePointerManager.RemoveTrigger(collider);
|
|
||||||
|
|
||||||
Detach();
|
Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if(m_attached && ((m_attachedPointer == null) || !m_attachedPointer.isActiveAndEnabled))
|
if(m_attached && ((m_attachedSender == null) || !m_attachedSender.isActiveAndEnabled))
|
||||||
Detach();
|
Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnTriggerEnter(Collider p_col)
|
void OnContactEnter(ContactCollisionInfo p_col)
|
||||||
{
|
{
|
||||||
if(m_ready && (RagdollController.Instance != null))
|
if(m_ready && (RagdollController.Instance != null) && ContactManager.Exists)
|
||||||
{
|
{
|
||||||
CVRPointer l_pointer = p_col.GetComponent<CVRPointer>();
|
ContactSender l_sender = ContactManager.Instance.GetSenderById(p_col.senderContactId);
|
||||||
|
if((l_sender != null) && (l_sender.collisionTags != null))
|
||||||
// Ragdolling
|
|
||||||
if(Settings.PointersReaction && !RagdollController.Instance.IsRagdolled())
|
|
||||||
{
|
{
|
||||||
if((l_pointer != null) && (l_pointer.type == c_ragdollPointerType) && l_pointer.enabled && !IgnoreCheck(l_pointer.transform))
|
foreach(string l_tag in l_sender.collisionTags)
|
||||||
RagdollController.Instance.Ragdoll();
|
{
|
||||||
}
|
switch(l_tag)
|
||||||
|
{
|
||||||
|
case c_ragdollPointerType:
|
||||||
|
{
|
||||||
|
if(Settings.PointersReaction && !RagdollController.Instance.IsRagdolled() && RestrictionsCheck(l_sender.transform.root))
|
||||||
|
RagdollController.Instance.Ragdoll();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
//Attachment
|
case c_grabPointerType:
|
||||||
if(!m_attached && RagdollController.Instance.IsRagdolled())
|
{
|
||||||
{
|
if(!m_attached && RagdollController.Instance.IsRagdolled() && RestrictionsCheck(l_sender.transform.root))
|
||||||
if((l_pointer != null) && (l_pointer.type == c_grabPointerType) && RestrictionsCheck(p_col.transform.root))
|
Attach(l_sender);
|
||||||
Attach(l_pointer);
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,16 +218,16 @@ namespace ml_prm
|
||||||
RemoveGameCollision();
|
RemoveGameCollision();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Attach(CVRPointer p_pointer)
|
void Attach(ContactSender p_sender)
|
||||||
{
|
{
|
||||||
if(!m_attached && (collider != null) && (m_rigidBody != null))
|
if(!m_attached && (collider != null) && (m_rigidBody != null) && !ms_attachedSenders.Contains(p_sender))
|
||||||
{
|
{
|
||||||
m_attachedPointer = p_pointer;
|
m_attachedSender = p_sender;
|
||||||
|
|
||||||
GameObject l_attachPoint = new GameObject("[AttachPoint]");
|
GameObject l_attachPoint = new GameObject("[AttachPoint]");
|
||||||
l_attachPoint.layer = CVRLayers.PlayerNetwork;
|
l_attachPoint.layer = CVRLayers.Default;
|
||||||
m_attachTransform = l_attachPoint.transform;
|
m_attachTransform = l_attachPoint.transform;
|
||||||
m_attachTransform.parent = p_pointer.transform;
|
m_attachTransform.parent = p_sender.transform;
|
||||||
|
|
||||||
Rigidbody l_body = l_attachPoint.AddComponent<Rigidbody>();
|
Rigidbody l_body = l_attachPoint.AddComponent<Rigidbody>();
|
||||||
l_body.isKinematic = true;
|
l_body.isKinematic = true;
|
||||||
|
|
@ -216,6 +238,7 @@ namespace ml_prm
|
||||||
m_attachJoint.breakForce = Mathf.Infinity;
|
m_attachJoint.breakForce = Mathf.Infinity;
|
||||||
m_attachJoint.breakTorque = Mathf.Infinity;
|
m_attachJoint.breakTorque = Mathf.Infinity;
|
||||||
|
|
||||||
|
ms_attachedSenders.Add(p_sender);
|
||||||
m_attached = true;
|
m_attached = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -232,7 +255,10 @@ namespace ml_prm
|
||||||
Object.Destroy(m_attachJoint);
|
Object.Destroy(m_attachJoint);
|
||||||
m_attachJoint = null;
|
m_attachJoint = null;
|
||||||
|
|
||||||
m_attachedPointer = null;
|
if(!ReferenceEquals(m_attachedSender, null))
|
||||||
|
ms_attachedSenders.Remove(m_attachedSender);
|
||||||
|
m_attachedSender = null;
|
||||||
|
|
||||||
m_attached = false;
|
m_attached = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -246,32 +272,12 @@ namespace ml_prm
|
||||||
BetterBetterCharacterController.Instance.IgnoreCollision(collider);
|
BetterBetterCharacterController.Instance.IgnoreCollision(collider);
|
||||||
}
|
}
|
||||||
|
|
||||||
// CVRTriggerVolume
|
internal void RestoreContact()
|
||||||
public void TriggerEnter(CVRPointer pointer)
|
|
||||||
{
|
|
||||||
if(Settings.PointersReaction && (pointer != null) && pointer.enabled && (pointer.type == c_ragdollPointerType) && !IgnoreCheck(pointer.transform) && (RagdollController.Instance != null) && !RagdollController.Instance.IsRagdolled())
|
|
||||||
RagdollController.Instance.Ragdoll();
|
|
||||||
}
|
|
||||||
public void TriggerExit(CVRPointer pointer)
|
|
||||||
{
|
{
|
||||||
|
if((m_contactReciever != null) && ContactManager.Exists)
|
||||||
|
ContactManager.Instance.RestoreContact(m_contactReciever, m_contactReciever.isActiveAndEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static utility
|
static bool RestrictionsCheck(Transform p_transform) => (p_transform != PlayerSetup.Instance.transform);
|
||||||
static bool IgnoreCheck(Transform p_transform)
|
|
||||||
{
|
|
||||||
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool RestrictionsCheck(Transform p_transform)
|
|
||||||
{
|
|
||||||
if(p_transform == PlayerSetup.Instance.transform)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PlayerDescriptor l_playerDescriptor = p_transform.GetComponent<PlayerDescriptor>();
|
|
||||||
if(l_playerDescriptor != null)
|
|
||||||
return (!Settings.FriendsGrab || Friends.FriendsWith(l_playerDescriptor.ownerId));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -677,6 +677,7 @@ namespace ml_prm
|
||||||
|
|
||||||
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
{
|
{
|
||||||
|
l_handler.RestoreContact();
|
||||||
l_handler.SetVelocity(l_velocity);
|
l_handler.SetVelocity(l_velocity);
|
||||||
l_handler.SetAngularVelocity(Vector3.zero);
|
l_handler.SetAngularVelocity(Vector3.zero);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ namespace ml_prm
|
||||||
AngularDrag,
|
AngularDrag,
|
||||||
Gravity,
|
Gravity,
|
||||||
PointersReaction,
|
PointersReaction,
|
||||||
IgnoreLocal,
|
|
||||||
CombatReaction,
|
CombatReaction,
|
||||||
AutoRecover,
|
AutoRecover,
|
||||||
RecoverDelay,
|
RecoverDelay,
|
||||||
|
|
@ -34,8 +33,7 @@ namespace ml_prm
|
||||||
Buoyancy,
|
Buoyancy,
|
||||||
FallDamage,
|
FallDamage,
|
||||||
FallLimit,
|
FallLimit,
|
||||||
GestureGrab,
|
GestureGrab
|
||||||
FriendsGrab
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool Hotkey { get; private set; } = true;
|
public static bool Hotkey { get; private set; } = true;
|
||||||
|
|
@ -45,7 +43,6 @@ namespace ml_prm
|
||||||
public static float AngularDrag { get; private set; } = 2f;
|
public static float AngularDrag { get; private set; } = 2f;
|
||||||
public static bool Gravity { get; private set; } = true;
|
public static bool Gravity { get; private set; } = true;
|
||||||
public static bool PointersReaction { get; private set; } = true;
|
public static bool PointersReaction { get; private set; } = true;
|
||||||
public static bool IgnoreLocal { get; private set; } = true;
|
|
||||||
public static bool CombatReaction { get; private set; } = true;
|
public static bool CombatReaction { get; private set; } = true;
|
||||||
public static bool AutoRecover { get; private set; } = false;
|
public static bool AutoRecover { get; private set; } = false;
|
||||||
public static float RecoverDelay { get; private set; } = 3f;
|
public static float RecoverDelay { get; private set; } = 3f;
|
||||||
|
|
@ -57,8 +54,6 @@ namespace ml_prm
|
||||||
public static bool FallDamage { get; private set; } = true;
|
public static bool FallDamage { get; private set; } = true;
|
||||||
public static float FallLimit { get; private set; } = 9.899494f;
|
public static float FallLimit { get; private set; } = 9.899494f;
|
||||||
public static bool GestureGrab { get; private set; } = false;
|
public static bool GestureGrab { get; private set; } = false;
|
||||||
public static bool FriendsGrab { get; private set; } = true;
|
|
||||||
public static float GrabDistance { get; private set; } = 0.1f;
|
|
||||||
|
|
||||||
public static readonly SettingEvent<bool> OnHotkeyChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnHotkeyChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<KeyCode> OnHotkeyKeyChanged = new SettingEvent<KeyCode>();
|
public static readonly SettingEvent<KeyCode> OnHotkeyKeyChanged = new SettingEvent<KeyCode>();
|
||||||
|
|
@ -67,7 +62,6 @@ namespace ml_prm
|
||||||
public static readonly SettingEvent<float> OnAngularDragChanged = new SettingEvent<float>();
|
public static readonly SettingEvent<float> OnAngularDragChanged = new SettingEvent<float>();
|
||||||
public static readonly SettingEvent<bool> OnGravityChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnGravityChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<bool> OnPointersReactionChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnPointersReactionChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<bool> OnIgnoreLocalChanged = new SettingEvent<bool>();
|
|
||||||
public static readonly SettingEvent<bool> OnCombatReactionChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnCombatReactionChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<bool> OnAutoRecoverChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnAutoRecoverChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<float> OnRecoverDelayChanged = new SettingEvent<float>();
|
public static readonly SettingEvent<float> OnRecoverDelayChanged = new SettingEvent<float>();
|
||||||
|
|
@ -79,8 +73,6 @@ namespace ml_prm
|
||||||
public static readonly SettingEvent<bool> OnFallDamageChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnFallDamageChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<float> OnFallLimitChanged = new SettingEvent<float>();
|
public static readonly SettingEvent<float> OnFallLimitChanged = new SettingEvent<float>();
|
||||||
public static readonly SettingEvent<bool> OnGestureGrabChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnGestureGrabChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<bool> OnFriendsGrabChanged = new SettingEvent<bool>();
|
|
||||||
public static readonly SettingEvent<float> OnGrabDistanceChanged = new SettingEvent<float>();
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
@ -98,7 +90,6 @@ namespace ml_prm
|
||||||
ms_category.CreateEntry(ModSetting.AngularDrag.ToString(), AngularDrag, null, null, true),
|
ms_category.CreateEntry(ModSetting.AngularDrag.ToString(), AngularDrag, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.Gravity.ToString(), Gravity, null, null, true),
|
ms_category.CreateEntry(ModSetting.Gravity.ToString(), Gravity, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.PointersReaction.ToString(), PointersReaction, null, null, true),
|
ms_category.CreateEntry(ModSetting.PointersReaction.ToString(), PointersReaction, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.IgnoreLocal.ToString(), IgnoreLocal, null, null, true),
|
|
||||||
ms_category.CreateEntry(ModSetting.CombatReaction.ToString(), CombatReaction, null, null, true),
|
ms_category.CreateEntry(ModSetting.CombatReaction.ToString(), CombatReaction, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.AutoRecover.ToString(), AutoRecover, null, null, true),
|
ms_category.CreateEntry(ModSetting.AutoRecover.ToString(), AutoRecover, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.RecoverDelay.ToString(), RecoverDelay, null, null, true),
|
ms_category.CreateEntry(ModSetting.RecoverDelay.ToString(), RecoverDelay, null, null, true),
|
||||||
|
|
@ -109,8 +100,7 @@ namespace ml_prm
|
||||||
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.FallDamage.ToString(), FallDamage, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.FallLimit.ToString(), FallLimit, null, null, true),
|
ms_category.CreateEntry(ModSetting.FallLimit.ToString(), FallLimit, null, null, true),
|
||||||
ms_category.CreateEntry(ModSetting.GestureGrab.ToString(), GestureGrab, null, null, true),
|
ms_category.CreateEntry(ModSetting.GestureGrab.ToString(), GestureGrab, null, null, true)
|
||||||
ms_category.CreateEntry(ModSetting.FriendsGrab.ToString(), FriendsGrab, null, null, true)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ms_entries[(int)ModSetting.HotkeyKey].OnEntryValueChangedUntyped.Subscribe(OnMelonSettingSave_HotkeyKey);
|
ms_entries[(int)ModSetting.HotkeyKey].OnEntryValueChangedUntyped.Subscribe(OnMelonSettingSave_HotkeyKey);
|
||||||
|
|
@ -122,7 +112,6 @@ namespace ml_prm
|
||||||
AngularDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.AngularDrag].BoxedValue, 0f, 50f);
|
AngularDrag = Mathf.Clamp((float)ms_entries[(int)ModSetting.AngularDrag].BoxedValue, 0f, 50f);
|
||||||
Gravity = (bool)ms_entries[(int)ModSetting.Gravity].BoxedValue;
|
Gravity = (bool)ms_entries[(int)ModSetting.Gravity].BoxedValue;
|
||||||
PointersReaction = (bool)ms_entries[(int)ModSetting.PointersReaction].BoxedValue;
|
PointersReaction = (bool)ms_entries[(int)ModSetting.PointersReaction].BoxedValue;
|
||||||
IgnoreLocal = (bool)ms_entries[(int)ModSetting.IgnoreLocal].BoxedValue;
|
|
||||||
CombatReaction = (bool)ms_entries[(int)ModSetting.CombatReaction].BoxedValue;
|
CombatReaction = (bool)ms_entries[(int)ModSetting.CombatReaction].BoxedValue;
|
||||||
AutoRecover = (bool)ms_entries[(int)ModSetting.AutoRecover].BoxedValue;
|
AutoRecover = (bool)ms_entries[(int)ModSetting.AutoRecover].BoxedValue;
|
||||||
RecoverDelay = Mathf.Clamp((float)ms_entries[(int)ModSetting.RecoverDelay].BoxedValue, 1f, 10f);
|
RecoverDelay = Mathf.Clamp((float)ms_entries[(int)ModSetting.RecoverDelay].BoxedValue, 1f, 10f);
|
||||||
|
|
@ -134,7 +123,6 @@ namespace ml_prm
|
||||||
FallDamage = (bool)ms_entries[(int)ModSetting.FallDamage].BoxedValue;
|
FallDamage = (bool)ms_entries[(int)ModSetting.FallDamage].BoxedValue;
|
||||||
FallLimit = Mathf.Clamp((float)ms_entries[(int)ModSetting.FallLimit].BoxedValue, 4.5f, 44.5f);
|
FallLimit = Mathf.Clamp((float)ms_entries[(int)ModSetting.FallLimit].BoxedValue, 4.5f, 44.5f);
|
||||||
GestureGrab = (bool)ms_entries[(int)ModSetting.GestureGrab].BoxedValue;
|
GestureGrab = (bool)ms_entries[(int)ModSetting.GestureGrab].BoxedValue;
|
||||||
FriendsGrab = (bool)ms_entries[(int)ModSetting.FriendsGrab].BoxedValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
|
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
|
||||||
|
|
@ -181,13 +169,6 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ModSetting.IgnoreLocal:
|
|
||||||
{
|
|
||||||
IgnoreLocal = (bool)p_value;
|
|
||||||
OnIgnoreLocalChanged.Invoke(IgnoreLocal);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ModSetting.CombatReaction:
|
case ModSetting.CombatReaction:
|
||||||
{
|
{
|
||||||
CombatReaction = (bool)p_value;
|
CombatReaction = (bool)p_value;
|
||||||
|
|
@ -251,13 +232,6 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ModSetting.FriendsGrab:
|
|
||||||
{
|
|
||||||
FriendsGrab = (bool)p_value;
|
|
||||||
OnFriendsGrabChanged.Invoke(FriendsGrab);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Floats
|
// Floats
|
||||||
case ModSetting.VelocityMultiplier:
|
case ModSetting.VelocityMultiplier:
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
using ABI.CCK.Components;
|
using ABI.CCK.Components;
|
||||||
using ABI_RC.Core.Player;
|
|
||||||
using ABI_RC.Core.Savior;
|
|
||||||
using ABI_RC.Systems.IK;
|
|
||||||
using ABI_RC.Systems.Movement;
|
using ABI_RC.Systems.Movement;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ABI_RC.Core.InteractionSystem;
|
using ABI_RC.Core.InteractionSystem;
|
||||||
|
using NAK.Contacts;
|
||||||
|
|
||||||
namespace ml_prm
|
namespace ml_prm
|
||||||
{
|
{
|
||||||
|
|
@ -18,6 +16,8 @@ namespace ml_prm
|
||||||
static readonly FieldInfo ms_influencerTouchingVolumes = typeof(PhysicsInfluencer).GetField("_touchingVolumes", BindingFlags.Instance | BindingFlags.NonPublic);
|
static readonly FieldInfo ms_influencerTouchingVolumes = typeof(PhysicsInfluencer).GetField("_touchingVolumes", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
static readonly FieldInfo ms_influencerSubmergedColliders = typeof(PhysicsInfluencer).GetField("_submergedColliders", BindingFlags.Instance | BindingFlags.NonPublic);
|
static readonly FieldInfo ms_influencerSubmergedColliders = typeof(PhysicsInfluencer).GetField("_submergedColliders", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
static readonly FieldInfo ms_lastCVRSeat = typeof(BetterBetterCharacterController).GetField("_lastCvrSeat", BindingFlags.Instance | BindingFlags.NonPublic);
|
static readonly FieldInfo ms_lastCVRSeat = typeof(BetterBetterCharacterController).GetField("_lastCvrSeat", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
static readonly FieldInfo ms_contactList = typeof(ContactManager).GetField("contactList", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
static readonly FieldInfo ms_pendingRemove = typeof(ContactManager).GetField("pendingRemove", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
|
||||||
public static void ClearFluidVolumes(this BetterBetterCharacterController p_instance) => (ms_touchingVolumes?.GetValue(p_instance) as List<FluidVolume>)?.Clear();
|
public static void ClearFluidVolumes(this BetterBetterCharacterController p_instance) => (ms_touchingVolumes?.GetValue(p_instance) as List<FluidVolume>)?.Clear();
|
||||||
|
|
||||||
|
|
@ -35,6 +35,18 @@ namespace ml_prm
|
||||||
|
|
||||||
public static CVRSeat GetCurrentSeat(this BetterBetterCharacterController p_instance) => (ms_lastCVRSeat?.GetValue(p_instance) as CVRSeat);
|
public static CVRSeat GetCurrentSeat(this BetterBetterCharacterController p_instance) => (ms_lastCVRSeat?.GetValue(p_instance) as CVRSeat);
|
||||||
|
|
||||||
|
public static bool IsRegistered(this ContactManager p_instance, ContactBase p_contact) => (ms_contactList?.GetValue(p_instance) as List<ContactBase>).Contains(p_contact);
|
||||||
|
|
||||||
|
public static void RestoreContact(this ContactManager p_instance, ContactBase p_contact, bool p_state)
|
||||||
|
{
|
||||||
|
if(p_instance.IsRegistered(p_contact))
|
||||||
|
(ms_pendingRemove?.GetValue(p_instance) as HashSet<int>).Remove(p_contact.ContactId);
|
||||||
|
else
|
||||||
|
p_instance.Register(p_contact);
|
||||||
|
|
||||||
|
p_instance.SetEnabled(p_contact.ContactId, p_state);
|
||||||
|
}
|
||||||
|
|
||||||
// Unity specific
|
// Unity specific
|
||||||
public static void CopyGlobal(this Transform p_source, Transform p_target)
|
public static void CopyGlobal(this Transform p_source, Transform p_target)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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.2.5</Version>
|
<Version>1.2.6</Version>
|
||||||
<Authors>SDraw</Authors>
|
<Authors>SDraw</Authors>
|
||||||
<Company>SDraw</Company>
|
<Company>SDraw</Company>
|
||||||
<Product>PlayerRagdollMod</Product>
|
<Product>PlayerRagdollMod</Product>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue