mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
rotating elements: only do auth on first lit/last darkened
This commit is contained in:
parent
4b679746e6
commit
133639353b
@ -73,9 +73,6 @@ public static class AuthorityManager
|
|||||||
{
|
{
|
||||||
identity.AssignClientAuthority(newConn);
|
identity.AssignClientAuthority(newConn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DebugLog.DebugWrite($"{identity.NetId}:{identity.gameObject.name} - "
|
|
||||||
// + $"set authority to {id}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -93,4 +90,4 @@ public static class AuthorityManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ internal abstract class QSBRotatingElements<T, U> : LinkedWorldObject<T, U>
|
|||||||
|
|
||||||
protected abstract IEnumerable<SingleLightSensor> LightSensors { get; }
|
protected abstract IEnumerable<SingleLightSensor> LightSensors { get; }
|
||||||
private QSBLightSensor[] _qsbLightSensors;
|
private QSBLightSensor[] _qsbLightSensors;
|
||||||
|
private int _litSensors;
|
||||||
|
|
||||||
public override async UniTask Init(CancellationToken ct)
|
public override async UniTask Init(CancellationToken ct)
|
||||||
{
|
{
|
||||||
@ -45,8 +46,23 @@ internal abstract class QSBRotatingElements<T, U> : LinkedWorldObject<T, U>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDetectLocalLight() => NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Add);
|
private void OnDetectLocalLight()
|
||||||
private void OnDetectLocalDarkness() => NetworkBehaviour.netIdentity.UpdateAuthQueue(AuthQueueAction.Remove);
|
{
|
||||||
|
_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;
|
protected override bool SpawnWithServerAuthority => false;
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,8 @@ internal abstract class RotatingElementsVariableSyncer<TWorldObject> : BaseVaria
|
|||||||
protected override bool HasChanged()
|
protected override bool HasChanged()
|
||||||
{
|
{
|
||||||
var rotatingElements = RotatingElements;
|
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++)
|
for (var i = 0; i < rotatingElements.Length; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user