Exemplo n.º 1
0
 public void DoUndock()
 {
     // if the module is not currently docked, fail silently.
     if (module.otherNode != null)
     {
         // check to see if either the undock or decouple events are available
         // and execute accordingly.
         var evnt1 = module.Events["Undock"];
         var evnt2 = module.Events["Decouple"];
         if (evnt1 != null && evnt1.guiActive && evnt1.active)
         {
             module.Undock();
         }
         else if (evnt2 != null && evnt2.guiActive && evnt2.active)
         {
             module.Decouple();
         }
         else
         {
             // If you can't do either event on this port, check to see if
             // you can on the port it's docked too!
             evnt1 = module.otherNode.Events["Undock"];
             evnt2 = module.otherNode.Events["Decouple"];
             if (evnt1 != null && evnt1.guiActive && evnt1.active)
             {
                 module.otherNode.Undock();
             }
             else if (evnt2 != null && evnt2.guiActive && evnt2.active)
             {
                 module.otherNode.Decouple();
             }
         }
     }
 }
Exemplo n.º 2
0
 public void forceUndock()
 {
     MonoBehaviour.print("Force undock!");
     if (dockNode.otherNode == null)
     {
         return;
     }
     dockNode.referenceNode.attachedPart = dockNode.otherNode.part;
     dockNode.Decouple();
     //updateState();
 }
Exemplo n.º 3
0
        public void ForceDecouple()
        {
            MDN = (ModuleDockingNode)GetModule("ModuleDockingNode");

            if (MDN == null)
            {
                return;
            }

            MDN.referenceNode.attachedPart = part.parent;
            MDN.Decouple();

            Events["ForceDecouple"].active    = false;
            Events["ForceDecouple"].guiActive = false;
        }
        /// <summary>
        /// Detach a docking node that was attached in the VAB.
        /// </summary>
        /// <param name="state">New state - must be 'false' to trigger</param>
        public void DockDetach(bool state)
        {
            if (vessel == null || state == true)
            {
                return;
            }

            ModuleDockingNode node = InferDockingNode(vessel);

            if (node != null)
            {
                if (node.state == "PreAttached")
                {
                    node.Decouple();
                }
            }
        }