示例#1
0
 private bool setupDockingNode(bool forceStart = true)
 {
     if (DeploymentProgress < 1 || constructionPort != null)
     {
         return(true);
     }
     this.Debug($"Setting up docking port");
     if (dockingNodeConfig == null)
     {
         this.Error($"{dockingNodeConfigName}: config node not found");
         return(false);
     }
     constructionPort = part.FindModulesImplementing <TemporaryDockingNode>()
                        .FirstOrDefault(m => m.nodeTransformName == constructionPortTransformName);
     if (constructionPort != null)
     {
         this.Debug($"Found existing docking port: {constructionPort.GetID()}");
         return(true);
     }
     this.Debug($"Creating new docking port from: {dockingNodeConfig}");
     constructionPort = TemporaryDockingNode.AddToPart(part, dockingNodeConfig, dockingNodeSave, forceStart);
     if (constructionPort == null)
     {
         this.Error($"{dockingNodeConfigName}: unable to add part module from the config node");
         return(false);
     }
     this.Debug($"Added new docking port: {constructionPort.GetID()}");
     return(true);
 }
示例#2
0
 private bool removeDockingNode()
 {
     if (constructionPort == null)
     {
         return(true);
     }
     if (!constructionPort.RemoveSelf())
     {
         return(false);
     }
     Destroy(constructionPort);
     constructionPort = null;
     dockingNodeSave  = null;
     return(true);
 }