Exemplo n.º 1
0
        public void ForceDock()
        {
            ModuleDockingNode dockingNode = this.part.FindModuleImplementing <ModuleDockingNode>();

            if (dockingNode == null)
            {
                return;
            }

            if (dockingNode.otherNode == null)
            {
                ScreenMessages.PostScreenMessage("Not close enough to dock.", 5.0f);
                return;
            }

            bool dockContact = dockingNode.CheckDockContact(dockingNode, dockingNode.otherNode, 5.0f, 0f, 0f);

            if (!dockContact)
            {
                ScreenMessages.PostScreenMessage("Not close enough to dock.", 5.0f);
                return;
            }

            if (dockingNode.NodeIsTooFar())
            {
                ScreenMessages.PostScreenMessage("Not close enough to dock.", 5.0f);
                return;
            }

            dockingNode.otherNode.DockToVessel(dockingNode);
            dockingNode.otherNode.Events["Undock"].guiActive = true;
            Events["UndockVessel"].guiActive = true;
            isForceDocked = true;
        }