using QSB.ShipSync.WorldObjects; using QSB.Syncs.Sectored.Rigidbodies; using QSB.Utility.LinkedWorldObject; using QSB.WorldSync; namespace QSB.ShipSync.TransformSync; public class ShipLegTransformSync : SectoredRigidbodySync, ILinkedNetworkBehaviour { /// /// normally prints error when attached object is null. /// this overrides it so that doesn't happen, since the module can be destroyed. /// protected override bool CheckValid() => AttachedTransform && base.CheckValid(); protected override bool CheckReady() => base.CheckReady() && _qsbModule != null // not sure how either of these can be null, but i guess better safe than sorry && _qsbModule.AttachedObject != null && _qsbModule.AttachedObject.isDetached; protected override bool UseInterpolation => true; private QSBShipDetachableLeg _qsbModule; public void SetWorldObject(IWorldObject worldObject) => _qsbModule = (QSBShipDetachableLeg)worldObject; protected override OWRigidbody InitAttachedRigidbody() { var owRigidbody = _qsbModule.AttachedObject.GetComponent(); SectorDetector.Init(owRigidbody.transform.Find("DetectorVolume").GetComponent()); return owRigidbody; } }