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

@ -41,25 +41,28 @@ namespace ml_pin
{ {
try try
{ {
bool l_isFriend = Friends.FriendsWith(p_player.ownerId); if(p_player != null) // This happens sometimes, no idea why
bool l_notify = false;
switch(Settings.NotifyType)
{ {
case Settings.NotificationType.None: bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
l_notify = false; bool l_notify = false;
break;
case Settings.NotificationType.Friends:
l_notify = (l_isFriend && ShouldNotifyInCurrentInstance());
break;
case Settings.NotificationType.All:
l_notify = ShouldNotifyInCurrentInstance();
break;
}
l_notify |= (l_isFriend && Settings.FriendsAlways);
if(l_notify) switch(Settings.NotifyType)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendJoin : SoundManager.SoundType.PlayerJoin); {
case Settings.NotificationType.None:
l_notify = false;
break;
case Settings.NotificationType.Friends:
l_notify = (l_isFriend && ShouldNotifyInCurrentInstance());
break;
case Settings.NotificationType.All:
l_notify = ShouldNotifyInCurrentInstance();
break;
}
l_notify |= (l_isFriend && Settings.FriendsAlways);
if(l_notify)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendJoin : SoundManager.SoundType.PlayerJoin);
}
} }
catch(Exception e) catch(Exception e)
{ {
@ -70,25 +73,28 @@ namespace ml_pin
{ {
try try
{ {
bool l_isFriend = Friends.FriendsWith(p_player.ownerId); if(p_player != null) // This happens sometimes, no idea why
bool l_notify = false;
switch(Settings.NotifyType)
{ {
case Settings.NotificationType.None: bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
l_notify = false; bool l_notify = false;
break;
case Settings.NotificationType.Friends:
l_notify = (l_isFriend && ShouldNotifyInCurrentInstance());
break;
case Settings.NotificationType.All:
l_notify = ShouldNotifyInCurrentInstance();
break;
}
l_notify |= (l_isFriend && Settings.FriendsAlways);
if(l_notify) switch(Settings.NotifyType)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendLeave : SoundManager.SoundType.PlayerLeave); {
case Settings.NotificationType.None:
l_notify = false;
break;
case Settings.NotificationType.Friends:
l_notify = (l_isFriend && ShouldNotifyInCurrentInstance());
break;
case Settings.NotificationType.All:
l_notify = ShouldNotifyInCurrentInstance();
break;
}
l_notify |= (l_isFriend && Settings.FriendsAlways);
if(l_notify)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendLeave : SoundManager.SoundType.PlayerLeave);
}
} }
catch(Exception e) catch(Exception e)
{ {

View file

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