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

@ -24,8 +24,8 @@ namespace ml_pin
{
m_soundManager = null;
CVRGameEventSystem.Player.OnJoin.RemoveListener(OnPlayerJoin);
CVRGameEventSystem.Player.OnLeave.RemoveListener(OnPlayerLeave);
CVRGameEventSystem.Player.OnJoinEntity.RemoveListener(OnPlayerJoin);
CVRGameEventSystem.Player.OnLeaveEntity.RemoveListener(OnPlayerLeave);
}
IEnumerator WaitForInstances()
@ -36,17 +36,17 @@ namespace ml_pin
m_soundManager = new SoundManager();
m_soundManager.LoadSounds();
CVRGameEventSystem.Player.OnJoin.AddListener(OnPlayerJoin);
CVRGameEventSystem.Player.OnLeave.AddListener(OnPlayerLeave);
CVRGameEventSystem.Player.OnJoinEntity.AddListener(OnPlayerJoin);
CVRGameEventSystem.Player.OnLeaveEntity.AddListener(OnPlayerLeave);
}
void OnPlayerJoin(PlayerDescriptor p_player)
void OnPlayerJoin(CVRPlayerEntity p_player)
{
try
{
if(p_player != null) // This happens sometimes, no idea why
if((p_player != null) && (p_player.PlayerDescriptor != null)) // This happens sometimes, no idea why
{
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_isFriend = Friends.FriendsWith(p_player.PlayerDescriptor.ownerId);
bool l_notify = false;
switch(Settings.NotifyType)
@ -72,13 +72,13 @@ namespace ml_pin
MelonLoader.MelonLogger.Warning(e);
}
}
void OnPlayerLeave(PlayerDescriptor p_player)
void OnPlayerLeave(CVRPlayerEntity p_player)
{
try
{
if(p_player != null) // This happens sometimes, no idea why
if((p_player != null) && (p_player.PlayerDescriptor != null)) // This happens sometimes, no idea why
{
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_isFriend = Friends.FriendsWith(p_player.PlayerDescriptor.ownerId);
bool l_notify = false;
switch(Settings.NotifyType)

View file

@ -1,4 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "1.0.7", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_pin.PlayersInstanceNotifier), "PlayersInstanceNotifier", "1.0.8", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]

View file

@ -7,7 +7,7 @@
<Authors>SDraw</Authors>
<Company>None</Company>
<Product>PlayersInstanceNotifier</Product>
<Version>1.0.7</Version>
<Version>1.0.8</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">