Exemplo n.º 1
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();
            }
        }
        private void DepartureCompletion()
        {
            RmmUtil.ToMapView();
            RmmContract.HandleContracts(_departureVessel, false, true);
            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
            {
                Funding.Instance.AddFunds(_mission.Price + cargoFee(), TransactionReasons.VesselRecovery);
            }

            handleUnloadCrew(_departureVessel, true);
            _departureVessel.Unload();
            _departureVessel.Die();

            ScreenMessages.PostScreenMessage(_mission.VesselName + " returned to " + RmmUtil.HomeBodyName(), 4, ScreenMessageStyle.UPPER_CENTER);
            finishDeparture();
        }
Exemplo n.º 3
0
        private void dockStage2()
        {
            RmmUtil.ToMapView();
            LoggerRmm.Debug("st2.1");
            ProtoVessel ProtoFlightVessel = loadVessel(_mission.FolderPath);

            LoggerRmm.Debug("st2.2");
            if (ProtoFlightVessel == null)
            {
                abortArrival(); return;
            }
            LoggerRmm.Debug("st2.3");
            if (loadVesselForRendezvous(ProtoFlightVessel, _targetVessel))
            {
                LoggerRmm.Debug("st2.4");
                _nextLogicTime = Planetarium.GetUniversalTime();
                _arrivalStage  = 3;
            }
        }
Exemplo n.º 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();
            }
        }