mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Minor cleanup
This commit is contained in:
parent
6a671d0da6
commit
9e841cef1c
15 changed files with 142 additions and 171 deletions
|
@ -2,7 +2,6 @@
|
|||
using ABI_RC.Core.UI;
|
||||
using ABI_RC.Systems.MovementSystem;
|
||||
using RootMotion.FinalIK;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.UI;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_asl
|
||||
{
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace ml_lme
|
|||
"leapmotion_hands.asset"
|
||||
};
|
||||
|
||||
static Dictionary<string, AssetBundle> ms_loadedAssets = new Dictionary<string, AssetBundle>();
|
||||
static Dictionary<string, GameObject> ms_loadedObjects = new Dictionary<string, GameObject>();
|
||||
static readonly Dictionary<string, AssetBundle> ms_loadedAssets = new Dictionary<string, AssetBundle>();
|
||||
static readonly Dictionary<string, GameObject> ms_loadedObjects = new Dictionary<string, GameObject>();
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
|
|
|
@ -283,7 +283,7 @@ namespace ml_lme
|
|||
{
|
||||
float l_strength = l_data.m_leftHand.m_grabStrength;
|
||||
|
||||
float l_interactValue = 0f;
|
||||
float l_interactValue;
|
||||
if(m_gripToGrab)
|
||||
l_interactValue = Mathf.Clamp01(Mathf.InverseLerp(Mathf.Min(Settings.GripThreadhold, Settings.InteractThreadhold), Mathf.Max(Settings.GripThreadhold, Settings.InteractThreadhold), l_strength));
|
||||
else
|
||||
|
@ -311,7 +311,7 @@ namespace ml_lme
|
|||
{
|
||||
float l_strength = l_data.m_rightHand.m_grabStrength;
|
||||
|
||||
float l_interactValue = 0f;
|
||||
float l_interactValue;
|
||||
if(m_gripToGrab)
|
||||
l_interactValue = Mathf.Clamp01(Mathf.InverseLerp(Mathf.Min(Settings.GripThreadhold, Settings.InteractThreadhold), Mathf.Max(Settings.GripThreadhold, Settings.InteractThreadhold), l_strength));
|
||||
else
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Systems.IK.SubSystems;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ml_lme
|
||||
{
|
||||
|
|
|
@ -4,17 +4,14 @@ namespace ml_lme
|
|||
{
|
||||
class VisualHand
|
||||
{
|
||||
Transform m_root = null;
|
||||
Transform m_wrist = null;
|
||||
Transform[] m_fingers = null;
|
||||
readonly Transform m_wrist = null;
|
||||
readonly Transform[] m_fingers = null;
|
||||
|
||||
public VisualHand(Transform p_root, bool p_left)
|
||||
{
|
||||
m_root = p_root;
|
||||
|
||||
if(m_root != null)
|
||||
if(p_root != null)
|
||||
{
|
||||
m_wrist = m_root.Find(p_left ? "LeftHand/Wrist" : "RightHand/Wrist");
|
||||
m_wrist = p_root.Find(p_left ? "LeftHand/Wrist" : "RightHand/Wrist");
|
||||
if(m_wrist != null)
|
||||
{
|
||||
m_fingers = new Transform[20];
|
||||
|
|
|
@ -59,12 +59,7 @@ namespace ml_pin
|
|||
l_notify |= (Settings.FriendsAlways && l_isFriend);
|
||||
|
||||
if(l_notify)
|
||||
{
|
||||
if(l_isFriend)
|
||||
m_soundManager?.PlaySound(SoundManager.SoundType.FriendJoin);
|
||||
else
|
||||
m_soundManager?.PlaySound(SoundManager.SoundType.PlayerJoin);
|
||||
}
|
||||
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendJoin : SoundManager.SoundType.PlayerJoin);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -93,12 +88,7 @@ namespace ml_pin
|
|||
l_notify |= (Settings.FriendsAlways && l_isFriend);
|
||||
|
||||
if(l_notify)
|
||||
{
|
||||
if(l_isFriend)
|
||||
m_soundManager?.PlaySound(SoundManager.SoundType.FriendLeave);
|
||||
else
|
||||
m_soundManager?.PlaySound(SoundManager.SoundType.PlayerLeave);
|
||||
}
|
||||
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendLeave : SoundManager.SoundType.PlayerLeave);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -108,9 +98,9 @@ namespace ml_pin
|
|||
|
||||
bool ShouldNotifyInCurrentInstance()
|
||||
{
|
||||
bool l_isInPublic = Settings.NotifyInPublic && MetaPort.Instance.CurrentInstancePrivacy.Contains("Public");
|
||||
bool l_isInFriends = Settings.NotifyInFriends && MetaPort.Instance.CurrentInstancePrivacy.Contains("Friends");
|
||||
bool l_isInPrivate = Settings.NotifyInPrivate && MetaPort.Instance.CurrentInstancePrivacy.Contains("invite");
|
||||
bool l_isInPublic = (Settings.NotifyInPublic && MetaPort.Instance.CurrentInstancePrivacy.Contains("Public"));
|
||||
bool l_isInFriends = (Settings.NotifyInFriends && MetaPort.Instance.CurrentInstancePrivacy.Contains("Friends"));
|
||||
bool l_isInPrivate = (Settings.NotifyInPrivate && MetaPort.Instance.CurrentInstancePrivacy.Contains("invite"));
|
||||
return (l_isInPublic || l_isInFriends || l_isInPrivate);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.IK;
|
||||
using ABI_RC.Systems.IK.SubSystems;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
|
@ -81,8 +80,8 @@ namespace ml_pmc
|
|||
CVRInputManager.Instance.individualFingerTracking = true;
|
||||
IKSystem.Instance.FingerSystem.controlActive = true;
|
||||
|
||||
ref float[] l_curls = ref m_puppetParser.GetFingerCurls();
|
||||
ref float[] l_spreads = ref m_puppetParser.GetFingerSpreads();
|
||||
ref readonly float[] l_curls = ref m_puppetParser.GetFingerCurls();
|
||||
ref readonly float[] l_spreads = ref m_puppetParser.GetFingerSpreads();
|
||||
|
||||
CVRInputManager.Instance.fingerCurlLeftThumb = l_curls[l_mirror ? 5 : 0];
|
||||
CVRInputManager.Instance.fingerCurlLeftIndex = l_curls[l_mirror ? 6 : 1];
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace ml_pmc
|
|||
float m_leftGesture = 0f;
|
||||
float m_rightGesture = 0f;
|
||||
bool m_fingerTracking = false;
|
||||
float[] m_fingerCurls = null;
|
||||
float[] m_fingerSpreads = null;
|
||||
readonly float[] m_fingerCurls = null;
|
||||
readonly float[] m_fingerSpreads = null;
|
||||
|
||||
internal PuppetParser()
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ namespace ml_pmc
|
|||
public float GetLeftGesture() => m_leftGesture;
|
||||
public float GetRightGesture() => m_rightGesture;
|
||||
public bool HasFingerTracking() => m_fingerTracking;
|
||||
public ref float[] GetFingerCurls() => ref m_fingerCurls;
|
||||
public ref float[] GetFingerSpreads() => ref m_fingerSpreads;
|
||||
public ref readonly float[] GetFingerCurls() => ref m_fingerCurls;
|
||||
public ref readonly float[] GetFingerSpreads() => ref m_fingerSpreads;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_pmc
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI_RC.Systems.Camera;
|
||||
using ABI_RC.Systems.IK;
|
||||
using ABI_RC.Systems.IK.SubSystems;
|
||||
|
@ -22,7 +21,6 @@ namespace ml_prm
|
|||
|
||||
public static RagdollController Instance { get; private set; } = null;
|
||||
|
||||
bool m_inVr = false;
|
||||
VRIK m_vrIK = null;
|
||||
bool m_applyHipsPosition = false;
|
||||
bool m_applyHipsRotation = false;
|
||||
|
@ -69,8 +67,6 @@ namespace ml_prm
|
|||
if(Instance == null)
|
||||
Instance = this;
|
||||
|
||||
m_inVr = Utils.IsInVR();
|
||||
|
||||
m_physicsMaterial = new PhysicMaterial("Ragdoll");
|
||||
m_physicsMaterial.dynamicFriction = c_defaultFriction;
|
||||
m_physicsMaterial.staticFriction = c_defaultFriction;
|
||||
|
@ -241,8 +237,6 @@ namespace ml_prm
|
|||
|
||||
internal void OnAvatarSetup()
|
||||
{
|
||||
m_inVr = Utils.IsInVR();
|
||||
|
||||
if(PlayerSetup.Instance._animator.isHuman)
|
||||
{
|
||||
BipedRagdollReferences l_avatarReferences = BipedRagdollReferences.FromAvatar(PlayerSetup.Instance._animator);
|
||||
|
|
|
@ -1,108 +1,108 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_prm
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
class RagdollTrigger : MonoBehaviour
|
||||
{
|
||||
const string c_ragdollPointerType = "ragdoll";
|
||||
|
||||
Collider m_collider = null;
|
||||
Collider m_lastColliderTrigger = null;
|
||||
ParticleSystem m_lastParticleSystemTrigger = null;
|
||||
bool m_triggered = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
m_collider = this.GetComponent<Collider>();
|
||||
|
||||
CVRParticlePointerManager.volumes.Add(new RagdollTriggerVolume(m_collider, this));
|
||||
CVRParticlePointerManager.UpdateParticleSystems();
|
||||
}
|
||||
|
||||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_prm
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
class RagdollTrigger : MonoBehaviour
|
||||
{
|
||||
const string c_ragdollPointerType = "ragdoll";
|
||||
|
||||
Collider m_collider = null;
|
||||
Collider m_lastColliderTrigger = null;
|
||||
ParticleSystem m_lastParticleSystemTrigger = null;
|
||||
bool m_triggered = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
m_collider = this.GetComponent<Collider>();
|
||||
|
||||
CVRParticlePointerManager.volumes.Add(new RagdollTriggerVolume(m_collider, this));
|
||||
CVRParticlePointerManager.UpdateParticleSystems();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
{
|
||||
if(m_collider != null)
|
||||
CVRParticlePointerManager.RemoveTrigger(m_collider);
|
||||
m_collider = null;
|
||||
|
||||
m_lastColliderTrigger = null;
|
||||
m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(!ReferenceEquals(m_lastColliderTrigger, null))
|
||||
{
|
||||
if(m_lastColliderTrigger != null)
|
||||
{
|
||||
if(!m_collider.bounds.Intersects(m_lastColliderTrigger.bounds))
|
||||
m_lastColliderTrigger = null;
|
||||
}
|
||||
else
|
||||
m_lastColliderTrigger = null;
|
||||
}
|
||||
if(!ReferenceEquals(m_lastParticleSystemTrigger, null))
|
||||
{
|
||||
if(m_lastParticleSystemTrigger != null)
|
||||
{
|
||||
if(m_lastParticleSystemTrigger.particleCount == 0)
|
||||
m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
else
|
||||
m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider p_other)
|
||||
{
|
||||
CVRPointer l_pointer = p_other.GetComponent<CVRPointer>();
|
||||
if((l_pointer != null) && (l_pointer.type == c_ragdollPointerType) && !IsIgnored(l_pointer.transform) && (m_lastColliderTrigger != p_other))
|
||||
{
|
||||
m_lastColliderTrigger = p_other;
|
||||
m_triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit(Collider p_other)
|
||||
{
|
||||
if(m_lastColliderTrigger == p_other)
|
||||
m_lastColliderTrigger = null;
|
||||
}
|
||||
|
||||
public void OnPointerParticleEnter(CVRPointer p_pointer)
|
||||
{
|
||||
m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(!ReferenceEquals(m_lastColliderTrigger, null))
|
||||
{
|
||||
if(m_lastColliderTrigger != null)
|
||||
{
|
||||
if(!m_collider.bounds.Intersects(m_lastColliderTrigger.bounds))
|
||||
m_lastColliderTrigger = null;
|
||||
}
|
||||
else
|
||||
m_lastColliderTrigger = null;
|
||||
}
|
||||
if(!ReferenceEquals(m_lastParticleSystemTrigger, null))
|
||||
{
|
||||
if(m_lastParticleSystemTrigger != null)
|
||||
{
|
||||
if(m_lastParticleSystemTrigger.particleCount == 0)
|
||||
m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
else
|
||||
m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider p_other)
|
||||
{
|
||||
CVRPointer l_pointer = p_other.GetComponent<CVRPointer>();
|
||||
if((l_pointer != null) && (l_pointer.type == c_ragdollPointerType) && !IsIgnored(l_pointer.transform) && (m_lastColliderTrigger != p_other))
|
||||
{
|
||||
m_lastColliderTrigger = p_other;
|
||||
m_triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit(Collider p_other)
|
||||
{
|
||||
if(m_lastColliderTrigger == p_other)
|
||||
m_lastColliderTrigger = null;
|
||||
}
|
||||
|
||||
public void OnPointerParticleEnter(CVRPointer p_pointer)
|
||||
{
|
||||
if(!this.gameObject.activeInHierarchy)
|
||||
return;
|
||||
|
||||
if((p_pointer.type == c_ragdollPointerType) && !IsIgnored(p_pointer.transform) && (m_lastParticleSystemTrigger != p_pointer.particleSystem))
|
||||
{
|
||||
m_lastParticleSystemTrigger = p_pointer.particleSystem;
|
||||
m_triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerParticleExit(CVRPointer p_pointer)
|
||||
{
|
||||
// This seems to be very unreliable, and it's causing weird behavior
|
||||
// if (!gameObject.activeInHierarchy) return;
|
||||
// if(m_lastParticleSystemTrigger == p_pointer.particleSystem)
|
||||
// m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
|
||||
public bool GetStateWithReset()
|
||||
{
|
||||
bool l_state = m_triggered;
|
||||
m_triggered = false;
|
||||
return l_state;
|
||||
}
|
||||
|
||||
static bool IsIgnored(Transform p_transform)
|
||||
{
|
||||
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
if((p_pointer.type == c_ragdollPointerType) && !IsIgnored(p_pointer.transform) && (m_lastParticleSystemTrigger != p_pointer.particleSystem))
|
||||
{
|
||||
m_lastParticleSystemTrigger = p_pointer.particleSystem;
|
||||
m_triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerParticleExit(CVRPointer p_pointer)
|
||||
{
|
||||
// This seems to be very unreliable, and it's causing weird behavior
|
||||
// if (!gameObject.activeInHierarchy) return;
|
||||
// if(m_lastParticleSystemTrigger == p_pointer.particleSystem)
|
||||
// m_lastParticleSystemTrigger = null;
|
||||
}
|
||||
|
||||
public bool GetStateWithReset()
|
||||
{
|
||||
bool l_state = m_triggered;
|
||||
m_triggered = false;
|
||||
return l_state;
|
||||
}
|
||||
|
||||
static bool IsIgnored(Transform p_transform)
|
||||
{
|
||||
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
using ABI_RC.Core.Savior;
|
||||
using ABI.CCK.Components;
|
||||
using UnityEngine;
|
||||
|
||||
using ABI_RC.Core.Savior;
|
||||
using ABI.CCK.Components;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ml_prm
|
||||
{
|
||||
class RagdollTriggerVolume : CVRTriggerVolume
|
||||
{
|
||||
readonly RagdollTrigger m_trigger = null;
|
||||
|
||||
public Collider collider { get; set; }
|
||||
|
||||
{
|
||||
class RagdollTriggerVolume : CVRTriggerVolume
|
||||
{
|
||||
readonly RagdollTrigger m_trigger = null;
|
||||
|
||||
public Collider collider { get; set; }
|
||||
|
||||
internal RagdollTriggerVolume(Collider p_collider, RagdollTrigger p_trigger)
|
||||
{
|
||||
collider = p_collider;
|
||||
m_trigger = p_trigger;
|
||||
}
|
||||
|
||||
public void TriggerEnter(CVRPointer pointer) => m_trigger.OnPointerParticleEnter(pointer);
|
||||
public void TriggerExit(CVRPointer pointer) => m_trigger.OnPointerParticleExit(pointer);
|
||||
}
|
||||
}
|
||||
collider = p_collider;
|
||||
m_trigger = p_trigger;
|
||||
}
|
||||
|
||||
public void TriggerEnter(CVRPointer pointer) => m_trigger.OnPointerParticleEnter(pointer);
|
||||
public void TriggerExit(CVRPointer pointer) => m_trigger.OnPointerParticleExit(pointer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ namespace ml_vei
|
|||
{
|
||||
GripTrigger = bool.Parse(p_value);
|
||||
GripTriggerChange?.Invoke(GripTrigger);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ms_entries[(int)l_setting].BoxedValue = bool.Parse(p_value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue