Propper game events

Ragdoll body parts grab
This commit is contained in:
SDraw 2024-08-10 15:29:40 +03:00
parent 8bead6a764
commit 84c255660e
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
12 changed files with 279 additions and 20 deletions

View file

@ -1,5 +1,6 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Util.AssetFiltering;
using ABI_RC.Systems.GameEventSystem;
using System;
using System.Collections.Generic;
using System.Reflection;
@ -17,6 +18,8 @@ namespace ml_prm
GameEvents.Init(HarmonyInstance);
WorldHandler.Init();
CVRGameEventSystem.Player.OnJoinEntity.AddListener(this.OnRemotePlayerCreated);
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
MelonLoader.MelonCoroutines.Start(WaitForWhitelist());
}
@ -28,6 +31,8 @@ namespace ml_prm
if(m_localController != null)
UnityEngine.Object.Destroy(m_localController);
m_localController = null;
CVRGameEventSystem.Player.OnJoinEntity.RemoveListener(this.OnRemotePlayerCreated);
}
System.Collections.IEnumerator WaitForLocalPlayer()
@ -50,5 +55,11 @@ namespace ml_prm
}
l_hashSet.Add(typeof(RagdollToggle));
}
void OnRemotePlayerCreated(CVRPlayerEntity p_player)
{
if((p_player != null) && (p_player.PuppetMaster != null))
p_player.PuppetMaster.gameObject.AddComponent<RemoteGestureHandler>();
}
}
}