This commit is contained in:
JohnCorby 2022-01-27 01:54:53 -08:00
parent c17cdcd537
commit d0491e33f0
2 changed files with 2 additions and 12 deletions

View File

@ -14,7 +14,6 @@ namespace QSB.JellyfishSync.TransformSync
protected override bool OnlyApplyOnDeserialize => true;
private QSBJellyfish _qsbJellyfish;
private AlignWithTargetBody _alignWithTargetBody;
private static readonly List<JellyfishTransformSync> _instances = new();
protected override OWRigidbody InitAttachedRigidbody()
@ -51,8 +50,6 @@ namespace QSB.JellyfishSync.TransformSync
AttachedRigidbody.OnUnsuspendOWRigidbody += OnUnsuspend;
AttachedRigidbody.OnSuspendOWRigidbody += OnSuspend;
netIdentity.SendAuthQueueMessage(AttachedRigidbody.IsSuspended() ? AuthQueueAction.Remove : AuthQueueAction.Add);
_alignWithTargetBody = AttachedRigidbody.GetComponent<AlignWithTargetBody>();
}
protected override void Uninit()
@ -71,18 +68,9 @@ namespace QSB.JellyfishSync.TransformSync
private void OnUnsuspend(OWRigidbody suspendedBody) => netIdentity.SendAuthQueueMessage(AuthQueueAction.Add);
private void OnSuspend(OWRigidbody suspendedBody) => netIdentity.SendAuthQueueMessage(AuthQueueAction.Remove);
protected override void GetFromAttached()
{
_alignWithTargetBody.enabled = true;
base.GetFromAttached();
}
/// replacement using SetPosition/Rotation instead of Move
protected override void ApplyToAttached()
{
_alignWithTargetBody.enabled = false;
var pos = ReferenceTransform.FromRelPos(transform.position);
AttachedRigidbody.SetPosition(pos);
AttachedRigidbody.SetRotation(ReferenceTransform.FromRelRot(transform.rotation));

View File

@ -16,6 +16,8 @@ namespace QSB.JellyfishSync.WorldObjects
public override void Init()
{
Object.Destroy(AttachedObject.GetComponent<AlignWithTargetBody>());
if (QSBCore.IsHost)
{
Object.Instantiate(QSBNetworkManager.singleton.JellyfishPrefab).SpawnWithServerAuthority();