示例#1
0
        private void ApplyMapTargetPatches()
        {
            if (!MapView.MapIsEnabled)
            {
                return;
            }

            // Grab the needed fields for reflection
            if (_fields == null)
            {
                FieldInfo modeField = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
                                      .FirstOrDefault(f => f.FieldType.IsEnum && f.FieldType.IsNested);
                FieldInfo contextField = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
                                         .FirstOrDefault(f => f.FieldType == typeof(MapContextMenu));
                FieldInfo castField = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
                                      .FirstOrDefault(f => f.FieldType == typeof(OrbitRenderer.OrbitCastHit));

                _fields = new[] { modeField, contextField, castField };
            }

            // Remove buttons in map view for barycenters
            if (!FlightGlobals.ActiveVessel)
            {
                return;
            }

            OrbitTargeter targeter = FlightGlobals.ActiveVessel.orbitTargeter;

            if (!targeter)
            {
                return;
            }

            Int32 mode = (Int32)_fields[0].GetValue(targeter);

            if (mode != 2)
            {
                return;
            }
            OrbitRenderer.OrbitCastHit cast = (OrbitRenderer.OrbitCastHit)_fields[2].GetValue(targeter);

            CelestialBody body = PSystemManager.Instance.localBodies.Find(b =>
                                                                          cast.or != null && cast.or.discoveryInfo?.name != null && b.name == cast.or.discoveryInfo.name.Value);

            if (!body)
            {
                return;
            }

            if (!body.Has("barycenter") && body.Get("selectable", true))
            {
                return;
            }

            if (!cast.driver || cast.driver.Targetable == null)
            {
                return;
            }

            MapContextMenu context = MapContextMenu.Create(body.name, new Rect(0.5f, 0.5f, 300f, 50f), cast, () =>
            {
                _fields[0].SetValue(targeter, 0);
                _fields[1].SetValue(targeter, null);
            }, new SetAsTarget(cast.driver.Targetable, () => FlightGlobals.fetch.VesselTarget));

            _fields[1].SetValue(targeter, context);
        }
        public static void Update()
        {
            _update = false;

            if (FlightGlobals.ActiveVessel == null ||
                FlightGlobals.ActiveVessel.targetObject == null ||
                FlightGlobals.ActiveVessel.targetObject.GetOrbit() == null ||
                FlightGlobals.ActiveVessel.targetObject.GetOrbit().referenceBody == null ||
                FlightGlobals.ActiveVessel.orbit == null ||
                FlightGlobals.ActiveVessel.orbit.referenceBody == null)
            {
                _updated = false;
                return;
            }

            _updated = true;

            Orbit active = _activeVessel.orbit;
            Orbit target = _targetObject.GetOrbit();

            _trueShipOrbit = active;

            _showAngle   = false;
            _showPhasing = false;

            _shipOrbit   = null;
            _targetOrbit = null;

            if (active.referenceBody == target.referenceBody)
            {
                _shipOrbit   = active;
                _targetOrbit = target;
            }
            else
            {
                if (active.referenceBody == Planetarium.fetch.Sun)
                {
                    _shipOrbit   = active;
                    _targetOrbit = target;
                }
                else
                {
                    _showAngle = true;
                }

                _showPhasing = true;

                DrillDownOrbits(active, target);
            }

            Vessel.Situations sit = _activeVessel.situation;

            if ((sit |= Vessel.Situations.LANDED | Vessel.Situations.SPLASHED | Vessel.Situations.PRELAUNCH) == 0)
            {
                _vesselIntersect = false;
                _bodyIntersect   = false;
            }
            else
            {
                if (!_isVessel && !_isCelestial)
                {
                    _vesselIntersect = false;
                    _bodyIntersect   = false;
                }
                else
                {
                    OrbitTargeter      oTargeter = _activeVessel.orbitTargeter;
                    PatchedConicSolver solver    = _activeVessel.patchedConicSolver;

                    if (oTargeter == null || solver == null)
                    {
                        _vesselIntersect = false;
                        _bodyIntersect   = false;
                    }
                    else if (!MapView.MapIsEnabled)
                    {
                        if (_isVessel)
                        {
                            _bodyIntersect = false;

                            Vessel tgt = _targetObject.GetVessel();

                            if (tgt == null || tgt.LandedOrSplashed)
                            {
                                _vesselIntersect = false;
                                return;
                            }

                            Orbit _refPatch = null;

                            if (solver.maneuverNodes.Count > 0)
                            {
                                _refPatch = GetReferencePatch(oTargeter, solver, target.referenceBody, null, true);
                            }
                            else
                            {
                                _refPatch = BasicOrbitReflection.GetRefPatch(oTargeter);
                            }

                            Orbit _tgtRefPatch = BasicOrbitReflection.GetTargetRefPatch(oTargeter);

                            _vesselIntersect = GetClosestVessel(_refPatch, _tgtRefPatch);
                        }
                        else
                        {
                            _vesselIntersect = false;

                            double Pe = GetLowestPeA(solver);

                            if (Pe < BasicExtensions.AlmostMaxValue)
                            {
                                _closestDist   = Pe;
                                _bodyIntersect = true;
                            }
                            else
                            {
                                Orbit _refPatch = null;

                                if (solver.maneuverNodes.Count > 0)
                                {
                                    _refPatch = GetReferencePatch(oTargeter, solver, _targetBody, target.referenceBody, false);
                                }
                                else
                                {
                                    _refPatch = BasicOrbitReflection.GetRefPatch(oTargeter);
                                }

                                if (_refPatch != null && _refPatch.closestTgtApprUT <= 0)
                                {
                                    _bodyIntersect = false;
                                    return;
                                }

                                Orbit _tgtRefPatch = BasicOrbitReflection.GetTargetRefPatch(oTargeter);

                                _bodyIntersect = GetClosestCelestial(_refPatch, _tgtRefPatch);
                            }
                        }
                    }
                    else
                    {
                        if (_markers == null || _markers.Count <= 0)
                        {
                            _markers = BasicOrbitReflection.GetOrbitMarkers(oTargeter);
                        }

                        if (_markers == null || _markers.Count <= 0)
                        {
                            _vesselIntersect = false;
                            _bodyIntersect   = false;
                        }
                        else if (_isVessel)
                        {
                            _bodyIntersect = false;

                            if (solver.maneuverNodes.Count > 0)
                            {
                                Orbit _refPatch    = GetReferencePatch(oTargeter, solver, target.referenceBody, null, true);
                                Orbit _tgtRefPatch = BasicOrbitReflection.GetTargetRefPatch(oTargeter);

                                _vesselIntersect = GetClosestVessel(_refPatch, _tgtRefPatch);
                            }
                            else
                            {
                                OrbitTargeter.ISectMarker _intersectOne = null;
                                OrbitTargeter.ISectMarker _intersectTwo = null;

                                for (int i = _markers.Count - 1; i >= 0; i--)
                                {
                                    OrbitTargeter.Marker m = _markers[i];

                                    if (m == null)
                                    {
                                        continue;
                                    }

                                    if (!(m is OrbitTargeter.ISectMarker))
                                    {
                                        continue;
                                    }

                                    int num = ((OrbitTargeter.ISectMarker)m).num;

                                    if (num == 1)
                                    {
                                        _intersectOne = m as OrbitTargeter.ISectMarker;
                                    }
                                    else if (num == 2)
                                    {
                                        _intersectTwo = m as OrbitTargeter.ISectMarker;
                                    }
                                }

                                OrbitTargeter.ISectMarker _closestIntersect = null;

                                if (_intersectOne != null && _intersectTwo != null)
                                {
                                    _closestIntersect = _intersectOne.separation > _intersectTwo.separation ? _intersectTwo : _intersectOne;
                                }
                                else if (_intersectOne != null)
                                {
                                    _closestIntersect = _intersectOne;
                                }
                                else if (_intersectTwo != null)
                                {
                                    _closestIntersect = _intersectTwo;
                                }
                                else
                                {
                                    _closestIntersect = null;
                                }

                                if (_closestIntersect == null)
                                {
                                    _vesselIntersect = false;
                                }
                                else
                                {
                                    _vesselIntersect = true;
                                    _closestDist     = _closestIntersect.separation * 1000;
                                    _closestRelVel   = _closestIntersect.relSpeed;
                                    _closestTime     = _closestIntersect.UT;
                                }
                            }
                        }
                        else
                        {
                            _vesselIntersect = false;

                            double Pe = GetLowestPeA(solver);

                            if (Pe < BasicExtensions.AlmostMaxValue)
                            {
                                _closestDist   = Pe;
                                _bodyIntersect = true;
                            }
                            else
                            {
                                if (solver.maneuverNodes.Count > 0)
                                {
                                    Orbit _refPatch    = GetReferencePatch(oTargeter, solver, _targetBody, target.referenceBody, false);
                                    Orbit _tgtRefPatch = BasicOrbitReflection.GetTargetRefPatch(oTargeter);

                                    _bodyIntersect = GetClosestCelestial(_refPatch, _tgtRefPatch);
                                }
                                else
                                {
                                    OrbitTargeter.ClApprMarker _approach = null;

                                    for (int i = _markers.Count - 1; i >= 0; i--)
                                    {
                                        OrbitTargeter.Marker m = _markers[i];

                                        if (m == null)
                                        {
                                            continue;
                                        }

                                        if (!(m is OrbitTargeter.ClApprMarker))
                                        {
                                            continue;
                                        }

                                        _approach = m as OrbitTargeter.ClApprMarker;
                                    }

                                    if (_approach == null)
                                    {
                                        _bodyIntersect = false;
                                    }
                                    else
                                    {
                                        _bodyIntersect = true;
                                        _closestDist   = _approach.separation * 1000;
                                        _closestTime   = (_approach.dT * -1) + Planetarium.GetUniversalTime();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        // Stuff
        void LateUpdate()
        {
            FixZooming();
            ApplyOrbitVisibility();
            RDFixer();

            // Remove buttons in map view for barycenters
            if (MapView.MapIsEnabled)
            {
                if (fields == null)
                {
                    FieldInfo mode_f    = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType.Name.EndsWith("MenuDrawMode"));
                    FieldInfo context_f = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType == typeof(MapContextMenu));
                    FieldInfo cast_f    = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType == typeof(OrbitRenderer.OrbitCastHit));
                    fields = new FieldInfo[] { mode_f, context_f, cast_f };
                }
                if (FlightGlobals.ActiveVessel != null)
                {
                    OrbitTargeter targeter = FlightGlobals.ActiveVessel.orbitTargeter;
                    if (targeter == null)
                    {
                        return;
                    }
                    Int32 mode = (Int32)fields[0].GetValue(targeter);
                    if (mode == 2)
                    {
                        OrbitRenderer.OrbitCastHit cast = (OrbitRenderer.OrbitCastHit)fields[2].GetValue(targeter);
                        CelestialBody body = PSystemManager.Instance.localBodies.Find(b => b.name == cast.or?.discoveryInfo?.name?.Value);
                        if (body == null)
                        {
                            return;
                        }
                        if (body.Has("barycenter") || body.Has("notSelectable"))
                        {
                            if (cast.driver?.Targetable == null)
                            {
                                return;
                            }
                            MapContextMenu context = MapContextMenu.Create(body.name, new Rect(0.5f, 0.5f, 300f, 50f), cast, () =>
                            {
                                fields[0].SetValue(targeter, 0);
                                fields[1].SetValue(targeter, null);
                            }, new SetAsTarget(cast.driver.Targetable, () => FlightGlobals.fetch.VesselTarget));
                            fields[1].SetValue(targeter, context);
                        }
                    }
                }
            }


            foreach (CelestialBody body in PSystemManager.Instance.localBodies)
            {
                if (body.afg == null)
                {
                    continue;
                }
                GameObject star_      = KopernicusStar.GetNearest(body).gameObject;
                Vector3    planet2cam = body.scaledBody.transform.position - body.afg.mainCamera.transform.position;
                body.afg.lightDot = Mathf.Clamp01(Vector3.Dot(planet2cam, body.afg.mainCamera.transform.position - star_.transform.position) * body.afg.dawnFactor);
                body.afg.GetComponent <Renderer>().material.SetFloat("_lightDot", body.afg.lightDot);
            }
        }
示例#4
0
        // Stuff
        void LateUpdate()
        {
            FixZooming();
            ApplyOrbitVisibility();
            RDFixer();
            ApplyOrbitIconCustomization();

            // Prevent the orbit lines from flickering
            PlanetariumCamera.Camera.farClipPlane = 1e14f;
            if (MapView.MapIsEnabled)
            {
                // Remove buttons in map view for barycenters
                if (fields == null)
                {
                    FieldInfo mode_f    = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType.IsEnum && f.FieldType.IsNested);
                    FieldInfo context_f = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType == typeof(MapContextMenu));
                    #if !KSP131
                    FieldInfo cast_f = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType == typeof(OrbitRendererBase.OrbitCastHit));
                    #else
                    FieldInfo cast_f = typeof(OrbitTargeter).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault(f => f.FieldType == typeof(OrbitRenderer.OrbitCastHit));
                    #endif
                    fields = new FieldInfo[] { mode_f, context_f, cast_f };
                }
                if (FlightGlobals.ActiveVessel != null)
                {
                    OrbitTargeter targeter = FlightGlobals.ActiveVessel.orbitTargeter;
                    if (targeter == null)
                    {
                        return;
                    }
                    Int32 mode = (Int32)fields[0].GetValue(targeter);
                    if (mode == 2)
                    {
                        #if !KSP131
                        OrbitRendererBase.OrbitCastHit cast = (OrbitRendererBase.OrbitCastHit)fields[2].GetValue(targeter);
                        #else
                        OrbitRenderer.OrbitCastHit cast = (OrbitRenderer.OrbitCastHit)fields[2].GetValue(targeter);
                        #endif
                        CelestialBody body = PSystemManager.Instance.localBodies.Find(b => b.name == cast.or?.discoveryInfo?.name?.Value);
                        if (body == null)
                        {
                            return;
                        }
                        if (body.Has("barycenter") || !body.Get("selectable", true))
                        {
                            if (cast.driver?.Targetable == null)
                            {
                                return;
                            }
                            MapContextMenu context = MapContextMenu.Create(body.name, new Rect(0.5f, 0.5f, 300f, 50f), cast, () =>
                            {
                                fields[0].SetValue(targeter, 0);
                                fields[1].SetValue(targeter, null);
                            }, new SetAsTarget(cast.driver.Targetable, () => FlightGlobals.fetch.VesselTarget));
                            fields[1].SetValue(targeter, context);
                        }
                    }
                }

                // If 3D rendering of orbits is forced, enable it
                if (Templates.force3DOrbits)
                {
                    MapView.fetch.max3DlineDrawDist           = Single.MaxValue;
                    GameSettings.MAP_MAX_ORBIT_BEFORE_FORCE2D = Int32.MaxValue;
                }
            }

            foreach (CelestialBody body in PSystemManager.Instance.localBodies)
            {
                if (body.afg == null)
                {
                    continue;
                }
                GameObject star_      = KopernicusStar.GetNearest(body).gameObject;
                Vector3    planet2cam = body.scaledBody.transform.position - body.afg.mainCamera.transform.position;
                body.afg.lightDot = Mathf.Clamp01(Vector3.Dot(planet2cam, body.afg.mainCamera.transform.position - star_.transform.position) * body.afg.dawnFactor);
                body.afg.GetComponent <Renderer>().sharedMaterial.SetFloat("_lightDot", body.afg.lightDot);
            }

            // Update the names of the presets in the settings dialog
            if (HighLogic.LoadedScene == GameScenes.SETTINGS)
            {
                foreach (SettingsTerrainDetail detail in Resources.FindObjectsOfTypeAll <SettingsTerrainDetail>())
                {
                    detail.displayStringValue = true;
                    detail.stringValues       = _details ?? (_details = Templates.PresetDisplayNames.ToArray());
                }
            }
        }
        public static void Update(bool target)
        {
            _update = false;

            _multipleManeuvers = false;

            if (FlightGlobals.ActiveVessel == null ||
                FlightGlobals.ActiveVessel.patchedConicSolver == null)
            {
                _updated = false;
                return;
            }

            PatchedConicSolver solver = FlightGlobals.ActiveVessel.patchedConicSolver;

            _node = solver.maneuverNodes[0];

            if (_node != null || _node.patch == null)
            {
                _maneuverTotal = _node.DeltaV.magnitude;

                _maneuverRemaining = _node.GetBurnVector(_node.patch).magnitude;

                if (BasicOrbitReflection.BetterBurnTimeLoaded)
                {
                    if (_bbVesselModule == null || _bbVesselReference != FlightGlobals.ActiveVessel)
                    {
                        for (int i = FlightGlobals.ActiveVessel.vesselModules.Count - 1; i >= 0; i--)
                        {
                            VesselModule vMod = FlightGlobals.ActiveVessel.vesselModules[i];

                            if (vMod == null)
                            {
                                continue;
                            }

                            if (vMod.GetType().Name != _bbModuleName)
                            {
                                continue;
                            }

                            _bbVesselModule    = vMod;
                            _bbVesselReference = FlightGlobals.ActiveVessel;
                            break;
                        }
                    }

                    if (_bbVesselModule != null)
                    {
                        string type = _bbVesselModule.Fields[_bbTypeName].GetValue(_bbVesselModule).ToString();

                        if (type == "Maneuver")
                        {
                            _burnLength = _bbVesselModule.Fields[_bbLengthName].GetValue <double>(_bbVesselModule);
                            _burnTime   = _bbVesselModule.Fields[_bbTimeName].GetValue <double>(_bbVesselModule);

                            if (double.IsNaN(_burnLength) || double.IsNaN(_burnTime))
                            {
                                _bbTimeLoaded = false;
                                _burnTime     = _node.UT;
                                _burnLength   = 0;
                            }
                            else
                            {
                                double half = _burnLength / 2;
                                _burnTime    -= half;
                                _bbTimeLoaded = true;
                            }
                        }
                        else
                        {
                            _bbTimeLoaded = false;
                            _burnTime     = _node.UT;
                        }
                    }
                    else
                    {
                        _bbTimeLoaded = false;
                        _burnTime     = _node.UT;
                    }
                }
                else
                {
                    _burnTime = _node.UT;
                }

                _showAngle         = false;
                _showPhasing       = false;
                _targetInclination = false;

                if (target)
                {
                    if (!BasicTargetting.IsVessel && !BasicTargetting.IsCelestial)
                    {
                        _vesselIntersect = false;
                        _bodyIntersect   = false;
                    }
                    else
                    {
                        Orbit targetOrbit = FlightGlobals.ActiveVessel.targetObject.GetOrbit();

                        Orbit active = FlightGlobals.ActiveVessel.orbit;

                        _targetPhasingOrbit = null;

                        if (active.referenceBody == targetOrbit.referenceBody)
                        {
                            _phasingNodePatch   = active;
                            _targetPhasingOrbit = targetOrbit;
                            _targetInclination  = true;
                        }
                        else
                        {
                            if (active.referenceBody != Planetarium.fetch.Sun)
                            {
                                _showAngle = true;
                            }

                            _showPhasing = true;

                            DrillDownOrbits(_node.patch, targetOrbit);
                        }

                        Vessel.Situations sit = FlightGlobals.ActiveVessel.situation;

                        if ((sit |= Vessel.Situations.LANDED | Vessel.Situations.SPLASHED | Vessel.Situations.PRELAUNCH) == 0)
                        {
                            _vesselIntersect = false;
                            _bodyIntersect   = false;
                        }
                        else
                        {
                            OrbitTargeter oTargeter = FlightGlobals.ActiveVessel.orbitTargeter;

                            if (oTargeter == null || solver == null)
                            {
                                _vesselIntersect = false;
                                _bodyIntersect   = false;
                            }
                            else if (!MapView.MapIsEnabled)
                            {
                                if (BasicTargetting.IsVessel)
                                {
                                    _bodyIntersect = false;

                                    Vessel tgt = FlightGlobals.ActiveVessel.targetObject.GetVessel();

                                    if (tgt == null || tgt.LandedOrSplashed)
                                    {
                                        _vesselIntersect = false;
                                        return;
                                    }

                                    Orbit _refPatch    = BasicOrbitReflection.GetRefPatch(oTargeter);
                                    Orbit _tgtRefPatch = BasicOrbitReflection.GetTargetRefPatch(oTargeter);

                                    _vesselIntersect = GetClosestVessel(_refPatch, _tgtRefPatch);
                                }
                                else
                                {
                                    _vesselIntersect = false;

                                    double Pe = GetLowestPeA(solver, BasicTargetting.TargetBody, _node.patch);

                                    if (Pe < BasicExtensions.AlmostMaxValue)
                                    {
                                        _closestDist   = Pe;
                                        _bodyIntersect = true;
                                    }
                                    else
                                    {
                                        Orbit _refPatch    = BasicOrbitReflection.GetRefPatch(oTargeter);
                                        Orbit _tgtRefPatch = BasicOrbitReflection.GetTargetRefPatch(oTargeter);

                                        if (_refPatch != null && _refPatch.closestTgtApprUT <= 0)
                                        {
                                            _bodyIntersect = false;
                                            return;
                                        }

                                        _bodyIntersect = GetClosestCelestial(_refPatch, _tgtRefPatch);
                                    }
                                }
                            }
                            else
                            {
                                if (BasicTargetting.Markers == null || BasicTargetting.Markers.Count <= 0)
                                {
                                    BasicTargetting.Markers = BasicOrbitReflection.GetOrbitMarkers(oTargeter);
                                }

                                if (BasicTargetting.IsVessel)
                                {
                                    _bodyIntersect = false;

                                    OrbitTargeter.ISectMarker _intersectOne = null;
                                    OrbitTargeter.ISectMarker _intersectTwo = null;

                                    for (int i = BasicTargetting.Markers.Count - 1; i >= 0; i--)
                                    {
                                        OrbitTargeter.Marker m = BasicTargetting.Markers[i];

                                        if (m == null)
                                        {
                                            continue;
                                        }

                                        if (!(m is OrbitTargeter.ISectMarker))
                                        {
                                            continue;
                                        }

                                        int num = ((OrbitTargeter.ISectMarker)m).num;

                                        if (num == 1)
                                        {
                                            _intersectOne = m as OrbitTargeter.ISectMarker;
                                        }
                                        else if (num == 2)
                                        {
                                            _intersectTwo = m as OrbitTargeter.ISectMarker;
                                        }
                                    }

                                    OrbitTargeter.ISectMarker _closestIntersect = null;

                                    if (_intersectOne != null && _intersectTwo != null)
                                    {
                                        _closestIntersect = _intersectOne.separation > _intersectTwo.separation ? _intersectTwo : _intersectOne;
                                    }
                                    else if (_intersectOne != null)
                                    {
                                        _closestIntersect = _intersectOne;
                                    }
                                    else if (_intersectTwo != null)
                                    {
                                        _closestIntersect = _intersectTwo;
                                    }
                                    else
                                    {
                                        _closestIntersect = null;
                                    }

                                    if (_closestIntersect == null)
                                    {
                                        _vesselIntersect = false;
                                    }
                                    else
                                    {
                                        _vesselIntersect = true;
                                        _closestDist     = _closestIntersect.separation * 1000;
                                        _closestRelVel   = _closestIntersect.relSpeed;
                                        _closestTime     = _closestIntersect.UT;
                                    }
                                }
                                else
                                {
                                    _vesselIntersect = false;

                                    double Pe = GetLowestPeA(solver, BasicTargetting.TargetBody, _node.patch);

                                    if (Pe < BasicExtensions.AlmostMaxValue)
                                    {
                                        _closestDist   = Pe;
                                        _bodyIntersect = true;
                                    }
                                    else
                                    {
                                        OrbitTargeter.ClApprMarker _approach = null;

                                        for (int i = BasicTargetting.Markers.Count - 1; i >= 0; i--)
                                        {
                                            OrbitTargeter.Marker m = BasicTargetting.Markers[i];

                                            if (m == null)
                                            {
                                                continue;
                                            }

                                            if (!(m is OrbitTargeter.ClApprMarker))
                                            {
                                                continue;
                                            }

                                            _approach = m as OrbitTargeter.ClApprMarker;
                                        }

                                        if (_approach == null)
                                        {
                                            _bodyIntersect = false;
                                        }
                                        else
                                        {
                                            _bodyIntersect = true;
                                            _closestDist   = _approach.separation * 1000;
                                            _closestTime   = (_approach.dT * -1) + Planetarium.GetUniversalTime();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (solver.maneuverNodes.Count > 1)
                {
                    _multipleManeuvers = true;

                    _allManeuverRemaining = 0;
                    _allManeuverTotal     = 0;

                    for (int i = solver.maneuverNodes.Count - 1; i >= 0; i--)
                    {
                        ManeuverNode n = solver.maneuverNodes[i];

                        if (n == null || n.patch == null)
                        {
                            continue;
                        }

                        _allManeuverTotal += n.DeltaV.magnitude;

                        _allManeuverRemaining += n.GetBurnVector(n.patch).magnitude;
                    }
                }

                _updated = true;
            }
        }