Revert "(TEMP CHEESE) RotatingElementsVariableSyncer: sync enabled state"

it does not work :(
This commit is contained in:
JohnCorby 2022-03-18 03:11:03 -07:00
parent 8bedbfe3f4
commit 8dbd884403

View File

@ -31,13 +31,10 @@ internal abstract class RotatingElementsVariableSyncer<TWorldObject> : BaseVaria
base.OnStopClient();
}
private bool _enabled, _prevEnabled;
protected abstract Transform[] RotatingElements { get; }
protected override bool HasChanged()
{
_enabled = WorldObject.AttachedObject.enabled;
var rotatingElements = RotatingElements;
Value ??= new Quaternion[rotatingElements.Length];
PrevValue ??= new Quaternion[rotatingElements.Length];
@ -47,11 +44,6 @@ internal abstract class RotatingElementsVariableSyncer<TWorldObject> : BaseVaria
Value[i] = rotatingElements[i].localRotation;
}
if (_enabled != _prevEnabled)
{
return true;
}
for (var i = 0; i < rotatingElements.Length; i++)
{
if (Quaternion.Angle(Value[i], PrevValue[i]) > 1)
@ -66,25 +58,13 @@ internal abstract class RotatingElementsVariableSyncer<TWorldObject> : BaseVaria
/// <summary>
/// copy array instead of setting, or else changes to values also happen on prev value
/// </summary>
protected override void UpdatePrevData()
{
_prevEnabled = _enabled;
protected override void UpdatePrevData() =>
Array.Copy(Value, PrevValue, Value.Length);
}
protected override void Serialize(NetworkWriter writer)
{
writer.Write(_enabled);
base.Serialize(writer);
}
protected override void Deserialize(NetworkReader reader)
{
_enabled = reader.Read<bool>();
base.Deserialize(reader);
WorldObject.AttachedObject.enabled = _enabled;
var rotatingElements = RotatingElements;
for (var i = 0; i < rotatingElements.Length; i++)
{