private void departureStage2()
        {
            if (RmmUtil.IsDocked(_vessel, _departurePart))
            {
                abortDeparture();
            }
            else
            {
                _departureVessel = _departurePart.vessel;
            }

            if (_departureVessel.isActiveVessel)
            {
                foreach (Vessel ves in FlightGlobals.Vessels)
                {
                    if (!ves.packed && ves.loaded && ves.id != _departureVessel.id)
                    {
                        FlightGlobals.SetActiveVessel(ves);
                        _departureStage = 3;
                        _nextLogicTime  = Planetarium.GetUniversalTime() + 1;
                        return;
                    }
                }
            }
            else
            {
                _departureStage = 3;
                _nextLogicTime  = Planetarium.GetUniversalTime() + 1;
            }
        }
 private void departureStage1()
 {
     if (RmmUtil.IsDocked(_vessel, _part))
     {
         ModuleDockingNode DockNode = _part.Modules.OfType <ModuleDockingNode>().FirstOrDefault();
         DockNode.Undock();
     }
     _departureStage = 2;
     _nextLogicTime  = Planetarium.GetUniversalTime() + 2;
 }
Beispiel #3
0
        private void dockStage5()
        {
            RmmUtil.ToMapView();
            if (RmmUtil.IsDocked(_targetVessel, _targetPart) ||
                (_nextLogicTime < (Planetarium.GetUniversalTime() - 8)))
            {
                ScreenMessages.PostScreenMessage(_mission.VesselName + " docked", 4, ScreenMessageStyle.UPPER_CENTER);

                finishArrival();
            }
        }
Beispiel #4
0
        private void dockStage4()
        {
            RmmUtil.ToMapView();
            Part placePort = new Part();

            // int portNumber = 0;
            foreach (Part p in transactionVessel.parts)
            {
                if (p.flightID == missionFlightIDDockPart)
                {
                    placePort = p;
                }
                foreach (PartModule pm in p.Modules)
                {
                    //if (pm.GetType() == typeof(ModuleDockingNode))
                    //{
                    //    RMMModule ComOffMod = p.Modules.OfType<RMMModule>().FirstOrDefault();
                    //    if (ComOffMod.trackingPrimary == true)
                    //    {
                    //        placePort = p;
                    //        if (missionOffering.ReturnEnabled)
                    //        {
                    //            ComOffMod.commercialvehiclemode = true;
                    //            ComOffMod.commercialvehicleFolderName = missionOffering.FolderPath;
                    //            ComOffMod.commercialvehiclePartCount = (float)RmmUtil.CountVesselParts(transactionVessel);
                    //            ComOffMod.trackingPrimary = false;
                    //        }
                    //    }
                    //    portNumber = portNumber + 1;
                    //
                    //    ComOffMod.trackingActive = false;
                    //    ComOffMod.returnMission = false;
                    //    ComOffMod.trackMissionId = "";
                    //    ComOffMod.PortCode = "";
                    //}

                    // empty all science
                    if (pm.GetType() == typeof(ModuleScienceContainer))
                    {
                        ModuleScienceContainer moduleScienceContainer = (ModuleScienceContainer)pm;
                        var scienceDatas = moduleScienceContainer.GetData();
                        for (int i = 0; i < scienceDatas.Count(); i++)
                        {
                            moduleScienceContainer.RemoveData(scienceDatas[i]);
                        }
                    }
                }
            }
            transactionVessel.targetObject = null;
            handleLoadCrew(transactionVessel, _mission.CrewCount, _mission.MinimumCrew, _mission.CrewSelection);
            RmmContract.HandleContracts(transactionVessel, true, false);
            LoggerRmm.Debug("st4.5" + RmmUtil.IsDocked(_targetVessel, _targetPart) + checkDockingPortCompatibility(placePort, _targetPart));
            if (!RmmUtil.IsDocked(_targetVessel, _targetPart) && checkDockingPortCompatibility(placePort, _targetPart))
            {
                LoggerRmm.Debug("st4.6");
                placeVesselForDock(transactionVessel, placePort, _targetVessel, _targetPart, RmmUtil.GetDockingDistance(placePort));
                LoggerRmm.Debug("st4.7");
                _nextLogicTime = Planetarium.GetUniversalTime();
                _arrivalStage  = 5;
            }
            else
            {
                ScreenMessages.PostScreenMessage(_mission.VesselName + " rendezvoused", 4, ScreenMessageStyle.UPPER_CENTER);
                finishArrival();
            }
        }