mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-07 13:05:41 +00:00
parent
b825fc588b
commit
c1df1ce3d4
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user