public void SetNodeTarget()
        {
            WBIDockingNodeHelper dockingModule = null;

            //Turn off all the glowing docking ports.
            foreach (Part part in this.vessel.parts)
            {
                //See if the part has a docking module
                dockingModule = part.FindModuleImplementing <WBIDockingNodeHelper>();
                if (dockingModule == null)
                {
                    continue;
                }

                //It does! Now turn off the glow animation
                if (dockingModule != this)
                {
                    dockingModule.TurnAnimationOff();
                }
            }

            //Turn our animation on
            TurnAnimationOn();

            //And call the real SetAsTarget
            dockingNode.SetAsTarget();
        }
        public void UpdateWeldGUI()
        {
            if (dockingNode == null)
            {
                dockingNode = this.part.FindModuleImplementing <ModuleDockingNode>();
            }
            if (dockingNode == null)
            {
                Debug.Log("Can't find a dockingNode");
                return;
            }

            //Welding GUI
            if (dockingNode.vesselInfo != null)
            {
                Events["WeldPorts"].guiActive = !WBIDockingParameters.WeldRequiresEVA;
            }

            //If we've already done the welding then disable the GUI.
            if (hasBeenWelded)
            {
                dockingNode.enabled                          = false;
                dockingNode.isEnabled                        = false;
                dockingNode.moduleIsEnabled                  = false;
                Events["WeldPorts"].guiActiveUnfocused       = false;
                Events["WeldPorts"].guiActive                = false;
                Events["UnsetNodeTarget"].guiActiveUnfocused = false;
                Events["SetNodeTarget"].guiActiveUnfocused   = false;

                ModuleAnimateGeneric glowAnim = this.part.FindModuleImplementing <ModuleAnimateGeneric>();
                if (glowAnim != null)
                {
                    if (glowAnim.Events["Toggle"].guiName == glowAnim.endEventGUIName)
                    {
                        glowAnim.Toggle();
                    }

                    glowAnim.enabled         = false;
                    glowAnim.isEnabled       = false;
                    glowAnim.moduleIsEnabled = false;
                }

                //If we're welded to a docking port without a WBIDockingNodeHelper then manually disable the other port.
                if (dockingNode != null && dockingNode.otherNode != null)
                {
                    WBIDockingNodeHelper otherNodeHelper = dockingNode.otherNode.part.FindModuleImplementing <WBIDockingNodeHelper>();
                    if (otherNodeHelper == null)
                    {
                        dockingNode.otherNode.enabled         = false;
                        dockingNode.otherNode.isEnabled       = false;
                        dockingNode.otherNode.moduleIsEnabled = false;
                    }
                }
            }

            else
            {
                Events["UnsetNodeTarget"].guiActiveUnfocused = false;
                Events["SetNodeTarget"].guiActiveUnfocused   = true;
            }
        }