Пример #1
0
 public double GetDelayToControl(Vessel vessel)
 {
     if (!RemoteTechHook.IsAvailable(vessel.id))
     {
         return(-1); // default to no connection if the vessel isn't configured for RT.
     }
     return(RemoteTechUtility.GetInputWaitTime(vessel));
 }
Пример #2
0
        private void UpdateDeployment(double deltaTime)
        {
            if (!RemoteTechHook.Instance.HasAnyConnection(Shared.Vessel.id))
            {
                if (!signalLossWarning)
                {
                    DrawStatus("Signal lost.  Waiting to re-acquire signal.");
                    progressBarSubBuffer.Enabled = true;
                    signalLossWarning            = true;
                }
            }
            else
            {
                if (signalLossWarning)
                {
                    if (double.IsPositiveInfinity(waitTotal))
                    {
                        waitTotal = RemoteTechUtility.GetTotalWaitTime(Shared.Vessel);
                    }
                    signalLossWarning = false;
                }

                waitElapsed += Math.Min(deltaTime, waitTotal - waitElapsed);
                DrawProgressBar(waitElapsed, waitTotal);

                if (waitElapsed == waitTotal)
                {
                    if (deployingBatch)
                    {
                        // deploy all commands
                        foreach (string commandText in batchQueue)
                        {
                            base.ProcessCommand(commandText);
                        }

                        batchQueue.Clear();
                        deployingBatch = false;
                    }
                    else
                    {
                        // deploy first command
                        if (commandQueue.Count > 0)
                        {
                            string commandText = commandQueue[0];
                            commandQueue.RemoveAt(0);
                            base.ProcessCommand(commandText);
                        }
                    }

                    StopDeployment();
                }
            }
        }
Пример #3
0
        public void Update(double deltaTime)
        {
            if (!deploymentInProgress && commandQueue.Count > 0 && !BatchMode)
            {
                waitTotal = RemoteTechUtility.GetTotalWaitTime(Shared.Vessel);
                StartDeployment();
                deltaTime = 0; // so the elapsed time is zero in this update
            }

            if (deploymentInProgress)
            {
                UpdateDeployment(deltaTime);
            }
        }
Пример #4
0
        private void ProcessDeployCommand()
        {
            if (!BatchMode)
            {
                throw new Exception("Batch mode is not active.");
            }
            if (batchQueue.Count == 0)
            {
                throw new Exception("There are no commands to deploy.");
            }

            waitTotal = RemoteTechUtility.GetTotalWaitTime(Shared.Vessel);
            if (double.IsPositiveInfinity(waitTotal))
            {
                throw new Exception("No connection available.");
            }

            Print("Deploying...");
            BatchMode      = false;
            deployingBatch = true;
            StartDeployment();
        }