private ScienceData makeScience(float boost) { ExperimentSituations vesselSituation = getSituation(); string biome = getBiome(vesselSituation); CelestialBody mainBody = vessel.mainBody; bool asteroids = false; //Check for asteroids and alter the biome and celestialbody values as necessary if (asteroidReports && (DMAsteroidScience.asteroidGrappled() || DMAsteroidScience.asteroidNear())) { newAsteroid = new DMAsteroidScience(); asteroids = true; mainBody = newAsteroid.body; biome = newAsteroid.aType + newAsteroid.aSeed.ToString(); } ScienceData data = null; ScienceExperiment exp = null; ScienceSubject sub = null; exp = ResearchAndDevelopment.GetExperiment(experimentID); if (exp == null) { Debug.LogError("[DM] Something Went Wrong Here; Null Experiment Returned; Please Report This On The KSP Forum With Output.log Data"); return(null); } sub = ResearchAndDevelopment.GetExperimentSubject(exp, vesselSituation, mainBody, biome); if (sub == null) { Debug.LogError("[DM] Something Went Wrong Here; Null Subject Returned; Please Report This On The KSP Forum With Output.log Data"); return(null); } if (asteroids) { DMUtils.OnAsteroidScience.Fire(newAsteroid.aClass, experimentID); sub.title = exp.experimentTitle + astCleanup(vesselSituation, newAsteroid.aType); registerDMScience(newAsteroid, exp, sub, vesselSituation, biome); mainBody.bodyName = bodyNameFixed; } else { DMUtils.OnAnomalyScience.Fire(mainBody, experimentID, biome); sub.title = exp.experimentTitle + situationCleanup(vesselSituation, biome); sub.subjectValue = fixSubjectValue(vesselSituation, sub.subjectValue, boost, mainBody); sub.scienceCap = exp.scienceCap * sub.subjectValue; } data = new ScienceData(exp.baseValue * sub.dataScale, xmitDataScalar, 0f, sub.id, sub.title); return(data); }
protected override bool canConduct() { if (base.canConduct()) { if (drillImpact(asteroidReports && DMAsteroidScience.asteroidGrappled())) { return(true); } failMessage = "The drill cannot impact the surface from this distance"; } return(false); }
protected virtual ExperimentSituations getSituation() { if (asteroidReports && DMAsteroidScience.asteroidGrappled()) { return(ExperimentSituations.SrfLanded); } if (asteroidReports && DMAsteroidScience.asteroidNear()) { return(ExperimentSituations.InSpaceLow); } switch (vessel.situation) { case Vessel.Situations.LANDED: case Vessel.Situations.PRELAUNCH: return(ExperimentSituations.SrfLanded); case Vessel.Situations.SPLASHED: return(ExperimentSituations.SrfSplashed); default: if (vessel.altitude < (vessel.mainBody.atmosphereScaleHeight * 1000 * Math.Log(1e6)) && vessel.mainBody.atmosphere) { if (vessel.altitude < vessel.mainBody.scienceValues.flyingAltitudeThreshold) { return(ExperimentSituations.FlyingLow); } else { return(ExperimentSituations.FlyingHigh); } } if (vessel.altitude < vessel.mainBody.scienceValues.spaceAltitudeThreshold) { return(ExperimentSituations.InSpaceLow); } else { return(ExperimentSituations.InSpaceHigh); } } }