public static ExperimentSituations getScienceSituation(double altitude, Vessel.Situations situation, CelestialBody body) { CelestialBodyScienceParams pars = body.scienceValues; if (situation == Vessel.Situations.LANDED || situation == Vessel.Situations.PRELAUNCH) { return(ExperimentSituations.SrfLanded); } else if (situation == Vessel.Situations.SPLASHED) { return(ExperimentSituations.SrfSplashed); } else if (body.atmosphere && altitude <= pars.flyingAltitudeThreshold) { return(ExperimentSituations.FlyingLow); } else if (body.atmosphere && altitude <= body.atmosphereScaleHeight * 1000 * 13.8) // -ln(10^-6) { return(ExperimentSituations.FlyingHigh); } else if (altitude <= pars.spaceAltitudeThreshold) { return(ExperimentSituations.InSpaceLow); } else { return(ExperimentSituations.InSpaceHigh); } }
public static float getScienceMultiplier(ExperimentSituations situation, CelestialBody body) { CelestialBodyScienceParams pars = body.scienceValues; switch (situation) { case ExperimentSituations.SrfLanded: return(pars.LandedDataValue); case ExperimentSituations.SrfSplashed: return(pars.SplashedDataValue); case ExperimentSituations.FlyingLow: return(pars.FlyingLowDataValue); case ExperimentSituations.FlyingHigh: return(pars.FlyingHighDataValue); case ExperimentSituations.InSpaceLow: return(pars.InSpaceLowDataValue); case ExperimentSituations.InSpaceHigh: return(pars.InSpaceHighDataValue); } return(1); }
public static ExperimentSituations getScienceSituation(double altitude, Vessel.Situations situation, CelestialBody body) { CelestialBodyScienceParams pars = body.scienceValues; if (situation == Vessel.Situations.LANDED || situation == Vessel.Situations.PRELAUNCH) { return(ExperimentSituations.SrfLanded); } else if (situation == Vessel.Situations.SPLASHED) { return(ExperimentSituations.SrfSplashed); } else if (body.atmosphere && altitude <= pars.flyingAltitudeThreshold) { return(ExperimentSituations.FlyingLow); } /* MKW - this calculation change needs testing! */ else if (body.atmosphere && altitude <= body.atmosphereDepth) { return(ExperimentSituations.FlyingHigh); } else if (altitude <= pars.spaceAltitudeThreshold) { return(ExperimentSituations.InSpaceLow); } else { return(ExperimentSituations.InSpaceHigh); } }
static void ParseScienceParams(CelestialBodyScienceParams scienceParams, ConfigNode node) { node.TryGetValue("flyingHighAltitudeThreshold", ref scienceParams.flyingAltitudeThreshold); node.TryGetValue("FlyingHighDataValue", ref scienceParams.FlyingHighDataValue); node.TryGetValue("FlyingLowDataValue", ref scienceParams.FlyingLowDataValue); node.TryGetValue("InSpaceHighDataValue", ref scienceParams.InSpaceHighDataValue); node.TryGetValue("InSpaceLowDataValue", ref scienceParams.InSpaceLowDataValue); node.TryGetValue("LandedDataValue", ref scienceParams.LandedDataValue); node.TryGetValue("RecoveryValue", ref scienceParams.RecoveryValue); node.TryGetValue("spaceAltitudeThreshold", ref scienceParams.spaceAltitudeThreshold); node.TryGetValue("SplashedDataValue", ref scienceParams.SplashedDataValue); }
// Standard constructor takes a science parameters object public ScienceValuesLoader (CelestialBodyScienceParams scienceParams) { this.scienceParams = scienceParams; }
// Standard constructor takes a science parameters object public ScienceValuesLoader(CelestialBodyScienceParams scienceParams) { this.scienceParams = scienceParams; }
public static JsonObject bodyJson(CelestialBody body, int index) { JsonObject json = new JsonObject(); if (body == null) { return(json); } JsonObject info = new JsonObject(); json.Add("info", info); info.Add("index", index); info.Add("name", body.name); info.Add("isStar", body.isStar); info.Add("isHomeWorld", body.isHomeWorld); info.Add("timeWarpAltitudeLimits", toJson(body.timeWarpAltitudeLimits)); info.Add("orbitingBodies", orbitingBodies(body)); JsonObject size = new JsonObject(); json.Add("size", size); size.Add("radius", body.Radius); size.Add("maxHeight", body.pqsController ? body.pqsController.mapMaxHeight : 0.0); size.Add("mass", body.Mass); size.Add("mu", body.gravParameter); size.Add("GeeASL", body.GeeASL); size.Add("g0", G0 * body.GeeASL); size.Add("sphereOfInfluence", body.sphereOfInfluence); size.Add("hillSphere", body.hillSphere); size.Add("oceanDensity", body.oceanDensity); JsonObject surface = new JsonObject(); json.Add("surface", surface); surface.Add("hasSolidSurface", body.hasSolidSurface); surface.Add("ocean", body.ocean); surface.Add("albedo", body.albedo); surface.Add("emissivity", body.emissivity); if (body.atmosphere) { JsonObject atmosphere = new JsonObject(); json.Add("atmosphere", atmosphere); atmosphere.Add("atmosphereDepth", body.atmosphereDepth); atmosphere.Add("atmosphereContainsOxygen", body.atmosphereContainsOxygen); } JsonObject rotation = new JsonObject(); json.Add("rotation", rotation); rotation.Add("axis", toJson(body.RotationAxis)); rotation.Add("solarDayLength", body.solarDayLength); rotation.Add("rotationPeriod", body.rotationPeriod); rotation.Add("solarRotationPeriod", body.solarRotationPeriod); rotation.Add("rotates", body.rotates); rotation.Add("tidallyLocked", body.tidallyLocked); rotation.Add("initialRotationRad", DEG2RAD * body.initialRotation); rotation.Add("initialRotationDeg", body.initialRotation); json.Add("orbit", orbitJson(body)); JsonObject science = new JsonObject(); json.Add("science", science); if (body.scienceValues != null) { CelestialBodyScienceParams sv = body.scienceValues; science.Add("flyingAltitudeThreshold", sv.flyingAltitudeThreshold); science.Add("spaceAltitudeThreshold", sv.spaceAltitudeThreshold); science.Add("InSpaceHighDataValue", sv.InSpaceHighDataValue); science.Add("InSpaceLowDataValue", sv.InSpaceLowDataValue); science.Add("FlyingLowDataValue", sv.FlyingLowDataValue); science.Add("FlyingHighDataValue", sv.FlyingHighDataValue); science.Add("LandedDataValue", sv.LandedDataValue); science.Add("SplashedDataValue", sv.SplashedDataValue); science.Add("RecoveryValue", sv.RecoveryValue); } science.Add("biomes", toJson(ResearchAndDevelopment.GetBiomeTags(body, false))); science.Add("miniBiomes", toJson(ResearchAndDevelopment.GetMiniBiomeTags(body))); JsonArray anomalies = new JsonArray(); PQSSurfaceObject[] aa = body.pqsSurfaceObjects; if (aa != null) { for (int i = 0; i < aa.Length; i++) { PQSSurfaceObject a = aa[i]; if (a != null && a.name != "Randolith") { JsonObject j = new JsonObject(); j.Add("name", a.name); Vector3d p = a.PlanetRelativePosition; j.Add("lat", Mathf.Rad2Deg * Mathf.Asin((float)p.normalized.y)); j.Add("lon", Mathf.Rad2Deg * Math.Atan2(p.z, p.x)); anomalies.Add(j); } } } json.Add("anomalies", anomalies); return(json); }