Minor code improvements

This commit is contained in:
SDraw 2024-09-25 01:52:36 +03:00
parent a2f9c1303e
commit 45557943c4
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
35 changed files with 557 additions and 835 deletions

View file

@ -1,33 +1,33 @@
using ABI_RC.Core.Player;
using System.Collections;
using System.Collections;
using UnityEngine;
namespace ml_amt
{
public class AvatarMotionTweaker : MelonLoader.MelonMod
{
MotionTweaker m_localTweaker = null;
MotionTweaker m_tweaker = null;
public override void OnInitializeMelon()
{
Settings.Init();
GameEvents.Init(HarmonyInstance);
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
MelonLoader.MelonCoroutines.Start(WaitForRootLogic());
}
IEnumerator WaitForLocalPlayer()
IEnumerator WaitForRootLogic()
{
while(PlayerSetup.Instance == null)
while(ABI_RC.Core.RootLogic.Instance == null)
yield return null;
m_localTweaker = PlayerSetup.Instance.gameObject.AddComponent<MotionTweaker>();
m_tweaker = new GameObject("[AvatarMotionTweaker]").AddComponent<MotionTweaker>();
}
public override void OnDeinitializeMelon()
{
if(m_localTweaker != null)
UnityEngine.Object.Destroy(m_localTweaker);
m_localTweaker = null;
if(m_tweaker != null)
Object.Destroy(m_tweaker.gameObject);
m_tweaker = null;
}
}
}