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
{
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_notify = false;
switch(Settings.NotifyType)
if(p_player != null) // This happens sometimes, no idea why
{
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);
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_notify = false;
if(l_notify)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendJoin : SoundManager.SoundType.PlayerJoin);
switch(Settings.NotifyType)
{
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)
{
@ -70,25 +73,28 @@ namespace ml_pin
{
try
{
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_notify = false;
switch(Settings.NotifyType)
if(p_player != null) // This happens sometimes, no idea why
{
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);
bool l_isFriend = Friends.FriendsWith(p_player.ownerId);
bool l_notify = false;
if(l_notify)
m_soundManager?.PlaySound(l_isFriend ? SoundManager.SoundType.FriendLeave : SoundManager.SoundType.PlayerLeave);
switch(Settings.NotifyType)
{
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)
{

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()