Offset in VR fix

Fix of illogical bug of null player descriptor
This commit is contained in:
SDraw 2024-01-30 23:32:51 +03:00
parent 84b0de7065
commit 171f129039
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
2 changed files with 41 additions and 35 deletions

View file

@ -40,6 +40,8 @@ namespace ml_pin
void OnPlayerJoin(PlayerDescriptor p_player)
{
try
{
if(p_player != null) // This happens sometimes, no idea why
{
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_notify = false;
@ -61,6 +63,7 @@ namespace ml_pin
if(l_notify)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendJoin : SoundManager.SoundType.PlayerJoin);
}
}
catch(Exception e)
{
MelonLoader.MelonLogger.Warning(e);
@ -69,6 +72,8 @@ namespace ml_pin
void OnPlayerLeave(PlayerDescriptor p_player)
{
try
{
if(p_player != null) // This happens sometimes, no idea why
{
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_notify = false;
@ -90,6 +95,7 @@ namespace ml_pin
if(l_notify)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendLeave : SoundManager.SoundType.PlayerLeave);
}
}
catch(Exception e)
{
MelonLoader.MelonLogger.Warning(e);

View file

@ -763,7 +763,7 @@ namespace ml_prm
internal bool ShoudlDisableHeadOffset()
{
return (!m_inVR && m_enabled && (m_vrIK != null));
return (m_enabled && (m_vrIK != null));
}
static void TryRestoreMovement()