Revert "OnPlayerLeave"

This reverts commit e2c2be9355.
This commit is contained in:
JohnCorby 2022-05-27 15:03:29 -07:00
parent b825fc588b
commit c1df1ce3d4

View File

@ -1,10 +1,7 @@
using Cysharp.Threading.Tasks;
using QSB.EchoesOfTheEye.LightSensorSync.Messages;
using QSB.EchoesOfTheEye.LightSensorSync.Messages;
using QSB.Messaging;
using QSB.Player;
using QSB.WorldSync;
using System;
using System.Threading;
namespace QSB.EchoesOfTheEye.LightSensorSync.WorldObjects;
@ -19,16 +16,4 @@ internal class QSBLightSensor : WorldObject<SingleLightSensor>
public override void SendInitialState(uint to) =>
this.SendMessage(new LightSensorAuthorityMessage(AuthorityOwner) { To = to });
public override async UniTask Init(CancellationToken ct) => QSBPlayerManager.OnRemovePlayer += OnPlayerLeave;
public override void OnRemoval() => QSBPlayerManager.OnRemovePlayer -= OnPlayerLeave;
private void OnPlayerLeave(PlayerInfo player)
{
if (AuthorityOwner == player.PlayerId)
{
// player left with authority, give it to us if we can
this.SendMessage(new LightSensorAuthorityMessage(AttachedObject.enabled ? QSBPlayerManager.LocalPlayerId : 0));
}
}
}