Too many changes

This commit is contained in:
SDraw 2024-10-05 15:42:32 +03:00
parent 45557943c4
commit a22e5992d0
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
72 changed files with 1064 additions and 927 deletions

View file

@ -1,10 +1,11 @@
using ABI_RC.Core.Player;
using UnityEngine;
namespace ml_pmc
{
public class PlayerMovementCopycat : MelonLoader.MelonMod
{
PoseCopycat m_localCopycat = null;
PoseCopycat m_poseCopycat = null;
public override void OnInitializeMelon()
{
@ -17,9 +18,9 @@ namespace ml_pmc
public override void OnDeinitializeMelon()
{
if(m_localCopycat != null)
UnityEngine.Object.Destroy(m_localCopycat);
m_localCopycat = null;
if(m_poseCopycat != null)
Object.Destroy(m_poseCopycat.gameObject);
m_poseCopycat = null;
}
System.Collections.IEnumerator WaitForLocalPlayer()
@ -27,7 +28,7 @@ namespace ml_pmc
while(PlayerSetup.Instance == null)
yield return null;
m_localCopycat = PlayerSetup.Instance.gameObject.AddComponent<PoseCopycat>();
m_poseCopycat = new GameObject("[PlayerMovementCopycat]").AddComponent<PoseCopycat>();
}
}
}

View file

@ -10,7 +10,7 @@ using UnityEngine;
namespace ml_pmc
{
[DisallowMultipleComponent]
public class PoseCopycat : MonoBehaviour
class PoseCopycat : MonoBehaviour
{
public class CopycatEvent<T1>
{
@ -22,7 +22,7 @@ namespace ml_pmc
static readonly Vector4 ms_pointVector = new Vector4(0f, 0f, 0f, 1f);
public static PoseCopycat Instance { get; private set; } = null;
static PoseCopycat ms_instance = null;
internal static readonly CopycatEvent<bool> OnCopycatChanged = new CopycatEvent<bool>();
Animator m_animator = null;
@ -43,10 +43,14 @@ namespace ml_pmc
void Awake()
{
if((Instance != null) && (Instance != this))
Object.Destroy(this);
else
Instance = this;
if(ms_instance != null)
{
DestroyImmediate(this);
return;
}
ms_instance = this;
DontDestroyOnLoad(this);
}
void Start()
@ -60,8 +64,8 @@ namespace ml_pmc
}
void OnDestroy()
{
if(Instance == this)
Instance = null;
if(ms_instance == this)
ms_instance = null;
m_poseHandler?.Dispose();
m_poseHandler = null;
@ -201,7 +205,7 @@ namespace ml_pmc
PlayerSetup.Instance.transform.rotation = l_result.rotation;
}
if(Vector3.Distance(this.transform.position, m_puppetParser.transform.position) > m_distanceLimit)
if(Vector3.Distance(PlayerSetup.Instance.GetPlayerPosition(), m_puppetParser.transform.position) > m_distanceLimit)
SetTarget(null);
}
else
@ -364,7 +368,7 @@ namespace ml_pmc
}
// Arbitrary
public void SetTarget(PuppetMaster p_target)
void SetTarget(PuppetMaster p_target)
{
if(m_animator != null)
{
@ -405,9 +409,6 @@ namespace ml_pmc
}
}
public bool IsActive() => m_active;
public bool IsFingerTrackingActive() => m_fingerTracking;
void OverrideIK()
{
if(!BodySystem.isCalibrating)

View file

@ -1,4 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_pmc.PlayerMovementCopycat), "PlayerMovementCopycat", "1.0.8", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_pmc.PlayerMovementCopycat), "PlayerMovementCopycat", "1.1.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPriority(3)]
[assembly: MelonLoader.MelonAdditionalDependencies("BTKUILib")]

View file

@ -5,7 +5,7 @@ Allows to copy pose, gestures and movement of your friends.
* Install [BTKUILib](https://github.com/BTK-Development/BTKUILib)
* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader)
* Get [latest release DLL](../../../releases/latest):
* Put `ml_pmc.dll` in `Mods` folder of game
* Put `PlayerMovementCopycat.dll` in `Mods` folder of game
# Usage
Available options in BTKUILib players list upon player selection:

View file

@ -5,9 +5,10 @@
<Platforms>x64</Platforms>
<PackageId>PlayerMovementCopycat</PackageId>
<Authors>SDraw</Authors>
<Company>None</Company>
<Company>SDraw</Company>
<Product>PlayerMovementCopycat</Product>
<Version>1.0.8</Version>
<Version>1.1.0</Version>
<AssemblyName>PlayerMovementCopycat</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">