mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-21 09:39:56 +00:00
simplify, handle edge cases
This commit is contained in:
parent
cc36df2f90
commit
3c0cdcb076
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -246,6 +246,7 @@ namespace QSB
|
||||
if (identity.ClientAuthorityOwner == conn)
|
||||
{
|
||||
identity.SetAuthority(QSBPlayerManager.LocalPlayerId);
|
||||
item.Orb.CancelDrag();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,5 @@ namespace QSB.ShipSync.TransformSync
|
||||
}
|
||||
|
||||
public override bool UseInterpolation => false;
|
||||
protected override float DistanceLeeway => 20f;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user