Revert "dont move probe back to launcher when it's retrieved. it actually looks better this way for non-player-launchers"

This reverts commit 840ce8119e.
This commit is contained in:
JohnCorby 2022-01-21 14:03:56 -08:00
parent 13b3f9c634
commit d724f11760
2 changed files with 34 additions and 1 deletions

View File

@ -70,6 +70,7 @@ namespace QSB.Syncs
protected abstract bool IsReady { get; }
protected abstract bool UseInterpolation { get; }
protected virtual bool AllowDisabledAttachedObject => false;
protected abstract bool AllowNullReferenceTransform { get; }
protected virtual bool IsPlayerObject => false;
protected virtual bool OnlyApplyOnDeserialize => false;
@ -176,7 +177,7 @@ namespace QSB.Syncs
return;
}
if (!AttachedTransform.gameObject.activeInHierarchy)
if (!AttachedTransform.gameObject.activeInHierarchy && !AllowDisabledAttachedObject)
{
return;
}

View File

@ -11,6 +11,7 @@ namespace QSB.Tools.ProbeTool.TransformSync
{
protected override float DistanceLeeway => 10f;
protected override bool UseInterpolation => true;
protected override bool AllowDisabledAttachedObject => true;
protected override bool IsPlayerObject => true;
public static PlayerProbeSync LocalInstance { get; private set; }
@ -62,6 +63,37 @@ namespace QSB.Tools.ProbeTool.TransformSync
return body;
}
protected override void GetFromAttached()
{
if (AttachedTransform.gameObject.activeInHierarchy)
{
base.GetFromAttached();
return;
}
var probeOWRigidbody = Locator.GetProbe().GetOWRigidbody();
if (probeOWRigidbody == null)
{
DebugLog.ToConsole($"Warning - Could not find OWRigidbody of local probe.", MessageType.Warning);
}
var probeLauncher = Player.LocalProbeLauncher;
// TODO : make this sync to the *active* probe launcher's _launcherTransform
var launcherTransform = probeLauncher._launcherTransform;
probeOWRigidbody.SetPosition(launcherTransform.position);
probeOWRigidbody.SetRotation(launcherTransform.rotation);
base.GetFromAttached();
var currentReferenceSector = ReferenceSector;
var playerReferenceSector = Player.TransformSync.ReferenceSector;
if (currentReferenceSector != playerReferenceSector)
{
SetReferenceSector(playerReferenceSector);
}
}
protected override bool IsReady => AttachedTransform != null || Locator.GetProbe() != null;
}
}