KAS.KASModuleAttachCore.UndockVessel C# (CSharp) Method

UndockVessel() private method

private UndockVessel ( ) : void
return void
        private void UndockVessel()
        {
            if (part.parent != null) {
              var my_node = part.FindAttachNodeByPart(part.parent);
              if (my_node != null) {
            my_node.attachedPart = null;
              }

              var other_node = part.parent.FindAttachNodeByPart(part);
              if (other_node != null) {
            other_node.attachedPart = null;
              }
            }

            part.Undock(vesselInfo);
        }

Usage Example

Example #1
0
        public void Detach(AttachType attachType)
        {
            KAS_Shared.DebugLog("Detach(Base) Attach mode is Docked:" + attachMode.Docked + ",Coupled:" + attachMode.Coupled + ",FixedJoint:" + attachMode.FixedJoint + ",StaticJoint:" + attachMode.StaticJoint);
            KAS_Shared.DebugLog("Detach(Base) Attach type is : " + attachType);

            // Docked
            if (attachType == AttachType.Docked)
            {
                if (dockedAttachModule.part.parent == this.part)
                {
                    KAS_Shared.DebugLog("Detach(Base) Undocking " + dockedAttachModule.part.partInfo.title + " from " + dockedAttachModule.vessel.vesselName);
                    dockedAttachModule.UndockVessel();
                }
                if (this.part.parent == dockedAttachModule.part)
                {
                    KAS_Shared.DebugLog("Detach(Base) Undocking " + this.part.partInfo.title + " from " + this.vessel.vesselName);
                    this.UndockVessel();
                }
                if (dockedAttachModule.dockedAttachModule == this)
                {
                    dockedAttachModule.dockedAttachModule = null;
                    dockedAttachModule.dockedPartID       = null;
                    dockedAttachModule.attachMode.Docked  = false;
                }
                this.dockedAttachModule = null;
                this.dockedPartID       = null;
                attachMode.Docked       = false;
            }
            // Coupled
            if (attachType == AttachType.Coupled)
            {
                // Todo
                attachMode.Coupled = false;
            }
            // FixedJoint
            if (attachType == AttachType.FixedJoint)
            {
                KAS_Shared.DebugLog("Detach(Base) Removing fixed joint on " + this.part.partInfo.title);
                if (FixedAttach.fixedJoint)
                {
                    Destroy(FixedAttach.fixedJoint);
                }
                SetCreateJointOnUnpack(false);
                FixedAttach.fixedJoint    = null;
                FixedAttach.connectedPart = null;
                attachMode.FixedJoint     = false;
            }
            // StaticJoint
            if (attachType == AttachType.StaticJoint)
            {
                KAS_Shared.DebugLog("Detach(Base) Removing static rigidbody and fixed joint on " + this.part.partInfo.title);
                if (StaticAttach.fixedJoint)
                {
                    Destroy(StaticAttach.fixedJoint);
                }
                if (StaticAttach.connectedGameObject)
                {
                    Destroy(StaticAttach.connectedGameObject);
                }
                StaticAttach.fixedJoint          = null;
                StaticAttach.connectedGameObject = null;
                attachMode.StaticJoint           = false;
            }
        }
All Usage Examples Of KAS.KASModuleAttachCore::UndockVessel