/// <summary> /// The KSP stock function has the nasty habit of returning, on occasion, /// situations that should not exist (flying high/low with bodies that /// don't have atmosphere), so we have to force the situations a bit. /// </summary> private void FixSituation() { var body = vessel.mainBody; var alt = vessel.altitude; var vi = Cache.VesselInfo(vessel); //if (vi.magnetosphere) sit = KerbalismSituations.Magnetosphere; //if (vi.outer_belt) sit = KerbalismSituations.OuterBelt; //if (vi.inner_belt) sit = KerbalismSituations.InnerBelt; // leave these as an easter eggs, for now if (vi.interstellar && body.flightGlobalsIndex == 0) { sit = KerbalismSituations.Interstellar; return; } if (body.atmosphere && // only on bodies with atmosphere vessel.verticalSpeed < 100 && // descending vessel.altitude < body.atmosphereDepth && // in the atmosphere vessel.altitude > body.scienceValues.flyingAltitudeThreshold && // above the flying high treshold (double.IsNaN(vessel.orbit.ApA) || vessel.orbit.ApA > body.atmosphereDepth) && // apoapsis above atmosphere or NaN vessel.srfSpeed > vessel.speedOfSound * 5) // mach 5 { sit = KerbalismSituations.Reentry; return; } if (vi.landed) { var s = ScienceUtil.GetExperimentSituation(vessel); switch (s) { case ExperimentSituations.SrfLanded: sit = KerbalismSituations.SrfLanded; return; case ExperimentSituations.SrfSplashed: sit = KerbalismSituations.SrfSplashed; return; } } var treshold = body.scienceValues.spaceAltitudeThreshold; if (alt > treshold) { sit = KerbalismSituations.InSpaceHigh; return; } if (alt > body.atmosphereDepth) { sit = KerbalismSituations.InSpaceLow; return; } if (body.atmosphere && alt > body.scienceValues.flyingAltitudeThreshold) { sit = KerbalismSituations.FlyingHigh; return; } sit = KerbalismSituations.FlyingLow; }
/// <summary> /// The KSP stock function has the nasty habit of returning, on occasion, /// situations that should not exist (flying high/low with bodies that /// don't have atmosphere), so we have to force the situations a bit. /// </summary> private void FixSituation() { var body = vessel.mainBody; var alt = vessel.altitude; var vi = Cache.VesselInfo(vessel); //if (vi.magnetosphere) sit = KerbalismSituations.Magnetosphere; //if (vi.outer_belt) sit = KerbalismSituations.OuterBelt; //if (vi.inner_belt) sit = KerbalismSituations.InnerBelt; // leave these as an easter eggs, for now if (vi.interstellar && body.flightGlobalsIndex == 0) { sit = KerbalismSituations.Interstellar; return; } if (body.atmosphere && vessel.loaded && vessel.altitude < body.atmosphereDepth && vessel.altitude > body.scienceValues.flyingAltitudeThreshold && vessel.orbit.ApA > body.atmosphereDepth && vessel.srfSpeed > 1984) { sit = KerbalismSituations.Reentry; return; } if (vi.landed) { var s = ScienceUtil.GetExperimentSituation(vessel); switch (s) { case ExperimentSituations.SrfLanded: sit = KerbalismSituations.SrfLanded; return; case ExperimentSituations.SrfSplashed: sit = KerbalismSituations.SrfSplashed; return; } } var treshold = body.scienceValues.spaceAltitudeThreshold; if (alt > treshold) { sit = KerbalismSituations.InSpaceHigh; return; } if (alt > body.atmosphereDepth) { sit = KerbalismSituations.InSpaceLow; return; } if (body.atmosphere && alt > body.scienceValues.flyingAltitudeThreshold) { sit = KerbalismSituations.FlyingHigh; return; } sit = KerbalismSituations.FlyingLow; }
internal KerbalismSituations StockSituation(KerbalismSituations s) { if (s < KerbalismSituations.InnerBelt) { return(s); } if (s == KerbalismSituations.Reentry) { return(KerbalismSituations.FlyingHigh); } return(KerbalismSituations.InSpaceHigh); }
private static string MaskToString(KerbalismSituations sit, uint situationMask, uint biomeMask) { string result = string.Empty; if (((int)sit & situationMask) == 0) { return(result); } result = Lib.SpacesOnCaps(sit.ToString().Replace("Srf", "")); if (((int)sit & biomeMask) != 0) { result += " (Biomes)"; } return(result); }