diff --git a/QSB/AuthoritySync/AuthorityManager.cs b/QSB/AuthoritySync/AuthorityManager.cs index b508d931..610d8d33 100644 --- a/QSB/AuthoritySync/AuthorityManager.cs +++ b/QSB/AuthoritySync/AuthorityManager.cs @@ -73,9 +73,6 @@ public static class AuthorityManager { identity.AssignClientAuthority(newConn); } - - // DebugLog.DebugWrite($"{identity.NetId}:{identity.gameObject.name} - " - // + $"set authority to {id}"); } #endregion @@ -93,4 +90,4 @@ public static class AuthorityManager } #endregion -} \ No newline at end of file +} diff --git a/QSB/EchoesOfTheEye/QSBRotatingElements.cs b/QSB/EchoesOfTheEye/QSBRotatingElements.cs index 8420dfe6..082755ec 100644 --- a/QSB/EchoesOfTheEye/QSBRotatingElements.cs +++ b/QSB/EchoesOfTheEye/QSBRotatingElements.cs @@ -19,6 +19,7 @@ internal abstract class QSBRotatingElements : LinkedWorldObject protected abstract IEnumerable LightSensors { get; } private QSBLightSensor[] _qsbLightSensors; + private int _litSensors; public override async UniTask Init(CancellationToken ct) { @@ -45,8 +46,23 @@ internal abstract class QSBRotatingElements : LinkedWorldObject } } - private void OnDetectLocalLight() => NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Add); - private void OnDetectLocalDarkness() => NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Remove); + private void OnDetectLocalLight() + { + _litSensors++; + if (_litSensors == 1) + { + NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Add); + } + } + + private void OnDetectLocalDarkness() + { + _litSensors--; + if (_litSensors == 0) + { + NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Remove); + } + } protected override bool SpawnWithServerAuthority => false; } diff --git a/QSB/EchoesOfTheEye/RotatingElementsVariableSyncer.cs b/QSB/EchoesOfTheEye/RotatingElementsVariableSyncer.cs index 33e8e8d2..c510a730 100644 --- a/QSB/EchoesOfTheEye/RotatingElementsVariableSyncer.cs +++ b/QSB/EchoesOfTheEye/RotatingElementsVariableSyncer.cs @@ -36,11 +36,8 @@ internal abstract class RotatingElementsVariableSyncer : BaseVaria protected override bool HasChanged() { var rotatingElements = RotatingElements; - if (Value == null) - { - Value = new Quaternion[rotatingElements.Length]; - PrevValue = new Quaternion[rotatingElements.Length]; - } + Value ??= new Quaternion[rotatingElements.Length]; + PrevValue ??= new Quaternion[rotatingElements.Length]; for (var i = 0; i < rotatingElements.Length; i++) {