Alek's suggestions

This commit is contained in:
Mister_Nebula 2020-09-16 15:53:40 +01:00
parent 1131715e1f
commit f4984b1e9f
2 changed files with 5 additions and 8 deletions

View File

@ -30,12 +30,8 @@ namespace QSB.OrbSync
{
return;
}
if (state)
{
WorldRegistry.RaiseEvent(InterfaceSlot, "OnSlotActivated");
return;
}
WorldRegistry.RaiseEvent(InterfaceSlot, "OnSlotDeactivated");
var ev = state ? "OnSlotActivated" : "OnSlotDeactivated";
WorldRegistry.RaiseEvent(InterfaceSlot, ev);
}
}
}

View File

@ -9,7 +9,7 @@ namespace QSB.TransformSync
public NomaiInterfaceOrb AttachedOrb { get; private set; }
public Transform OrbTransform { get; private set; }
private int Index => WorldRegistry.OrbSyncList.FindIndex(x => x == this);
private int Index => WorldRegistry.OrbSyncList.IndexOf(this);
private const int MaxUpdatesBeforeDisable = 5;
@ -22,7 +22,7 @@ namespace QSB.TransformSync
{
WorldRegistry.OrbSyncList.Add(this);
QSB.Helper.Events.Unity.RunWhen(() => WorldRegistry.OldOrbList.Count != 0, OnReady);
QSB.Helper.Events.Unity.RunWhen(() => WorldRegistry.OldOrbList.Count > 0, OnReady);
}
private void OnReady()
@ -75,6 +75,7 @@ namespace QSB.TransformSync
}
OrbTransform.position = _orbParent.TransformPoint(transform.position);
OrbTransform.rotation = _orbParent.InverseTransformRotation(OrbTransform.rotation);
if (transform.localPosition == Vector3.zero)
{
_updateCount++;