simplify, handle edge cases

This commit is contained in:
JohnCorby 2021-12-13 21:52:59 -08:00
parent cc36df2f90
commit 3c0cdcb076
5 changed files with 10 additions and 12 deletions

View File

@ -57,7 +57,7 @@ namespace QSB.OrbSync.Events
}
orbSync.enabled = true;
if (!isLocal)
if (!isLocal && !orbSync.Orb._isBeingDragged)
{
orbSync.Orb._isBeingDragged = true;
orbSync.Orb._interactibleCollider.enabled = false;
@ -69,7 +69,7 @@ namespace QSB.OrbSync.Events
}
else
{
if (!isLocal)
if (!isLocal && orbSync.Orb._isBeingDragged)
{
orbSync.Orb._isBeingDragged = false;
orbSync.Orb._interactibleCollider.enabled = true;

View File

@ -25,12 +25,12 @@ namespace QSB.OrbSync.Patches
}
}
[HarmonyPostfix]
[HarmonyPrefix]
[HarmonyPatch(typeof(NomaiInterfaceOrb), nameof(NomaiInterfaceOrb.CancelDrag))]
public static void NomaiInterfaceOrb_CancelDrag(NomaiInterfaceOrb __instance)
{
var index = OrbManager.Orbs.IndexOf(__instance);
if (index != -1)
if (index != -1 && __instance._isBeingDragged)
{
QSBEventManager.FireEvent(EventNames.QSBOrbUser, index, false);
}

View File

@ -76,14 +76,13 @@ namespace QSB.OrbSync.TransformSync
protected override bool UpdateTransform()
{
if (!base.UpdateTransform())
if (HasAuthority)
{
return false;
transform.position = ReferenceTransform.ToRelPos(AttachedObject.position);
}
if (!HasAuthority)
else
{
Orb.SetTargetPosition(AttachedObject.position);
Orb.SetTargetPosition(ReferenceTransform.FromRelPos(transform.position));
}
return true;
@ -92,8 +91,7 @@ namespace QSB.OrbSync.TransformSync
protected override Transform InitLocalTransform() => GetTransform();
protected override Transform InitRemoteTransform() => GetTransform();
protected override float DistanceLeeway => 1f;
public override bool IsReady => WorldObjectManager.AllObjectsReady;
public override bool UseInterpolation => true;
public override bool UseInterpolation => false;
}
}

View File

@ -246,6 +246,7 @@ namespace QSB
if (identity.ClientAuthorityOwner == conn)
{
identity.SetAuthority(QSBPlayerManager.LocalPlayerId);
item.Orb.CancelDrag();
}
}

View File

@ -101,6 +101,5 @@ namespace QSB.ShipSync.TransformSync
}
public override bool UseInterpolation => false;
protected override float DistanceLeeway => 20f;
}
}