fix OnPlayerLeave for slides/code controller

This commit is contained in:
JohnCorby 2022-10-06 20:57:14 -07:00
parent 5368d6548a
commit fda330d768
3 changed files with 11 additions and 5 deletions

View File

@ -32,13 +32,16 @@ public class QSBEclipseCodeController : WorldObject<EclipseCodeController4>
}
}
private void OnPlayerLeave(PlayerInfo obj)
private void OnPlayerLeave(PlayerInfo player)
{
if (!QSBCore.IsHost)
{
return;
}
this.SendMessage(new UseControllerMessage(false));
if (PlayerInControl == player)
{
this.SendMessage(new UseControllerMessage(false));
}
}
public void SetUser(uint user)

View File

@ -17,13 +17,16 @@ public class QSBSlideProjector : WorldObject<SlideProjector>
public override void OnRemoval() =>
QSBPlayerManager.OnRemovePlayer -= OnPlayerLeave;
private void OnPlayerLeave(PlayerInfo obj)
private void OnPlayerLeave(PlayerInfo player)
{
if (!QSBCore.IsHost)
{
return;
}
this.SendMessage(new UseSlideProjectorMessage(false));
if (_user == player.PlayerId)
{
this.SendMessage(new UseSlideProjectorMessage(false));
}
}
public override void SendInitialState(uint to) =>

View File

@ -369,7 +369,7 @@ public class QSBNetworkManager : NetworkManager, IAddComponentOnStart
}
// stop dragging for the orbs this player was dragging
// why tf is this here instead of QSBOrb.OnPlayerLeave?
// i THINK this is here because orb authority is in network behavior, which may not work properly in OnPlayerLeave
foreach (var qsbOrb in QSBWorldSync.GetWorldObjects<QSBOrb>())
{
if (qsbOrb.NetworkBehaviour == null)