Esempio n. 1
0
        public override void ReviewData()
        {
            float scienceCap   = WBIBiomeAnalysis.GetScienceCap(this.part);
            float totalScience = scienceAdded;

            if (totalScience < 0.001f)
            {
                ScreenMessages.PostScreenMessage(kNoScience, 5.0f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            while (totalScience > 0.001f)
            {
                //Set the experiment title
                if (totalScience < scienceCap)
                {
                    dataAmount = totalScience;
                }
                else
                {
                    dataAmount = scienceCap;
                }

                //Generate lab data
                ScienceData data = WBIBiomeAnalysis.CreateData(this.part, dataAmount);
                scienceContainer.AddData(data);

                //Deduct from the total
                totalScience -= dataAmount;
                if (totalScience <= 0.001f)
                {
                    scienceAdded = 0f;
                }
            }

            //Make sure we have some science to transmit.
            if (scienceContainer.GetScienceCount() == 0)
            {
                ScreenMessages.PostScreenMessage(kNoScience, 5.0f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            //Review the data
            scienceContainer.ReviewData();
            swizzler.SwizzleResultsDialog();
        }
Esempio n. 2
0
        protected override void onCriticalSuccess()
        {
            if (scienceContainer == null)
            {
                scienceContainer = this.part.FindModuleImplementing <ModuleScienceContainer>();
            }

            //Time to pay the piper
            if (currentExperiment == GeologyLabExperiments.BiomeAnalysis)
            {
                if (ResearchAndDevelopment.Instance.Science >= kBiomeResearchCost)
                {
                    ResearchAndDevelopment.Instance.AddScience(-kBiomeResearchCost, TransactionReasons.RnDTechResearch);
                }

                //Not enough science. Efforts wasted.
                else
                {
                    ScreenMessages.PostScreenMessage(kNotEnoughScience, 5.0f, ScreenMessageStyle.UPPER_CENTER);
                    StopConverter();
                    return;
                }

                //Generate biome analysis
                ScienceData data = WBIBiomeAnalysis.CreateData(this.part, kBiomeResearchCost * (1.0f + getBiomeAnalysisBonus() / 100f));
                scienceContainer.AddData(data);
            }

            else
            {
                float efficiencyModifier = 0.1f + (totalCrewSkill / 100f);

                applyResults(efficiencyModifier, kBetterEfficiency);

                //Reduce core sample count
                dumpFirstCoreSample();
            }
        }
Esempio n. 3
0
        protected void perfomBiomeAnalysys()
        {
            //We need at least one crewmember in the lab.
            if (this.part.protoModuleCrew.Count == 0)
            {
                ScreenMessages.PostScreenMessage(kNoCrew, kMessageDuration, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            //We need at least one scientist in the lab, or one TERRAIN satellite in orbit.
            float scienceBonus = getBiomeAnalysisBonus();

            //We can run the analysis, add the science bonus
            if (scienceBonus > 0.0f)
            {
                //Generate lab data
                ScienceData data = WBIBiomeAnalysis.CreateData(this.part, scienceBonus);
                scienceContainer.AddData(data);
                scienceContainer.ReviewDataItem(data);
                swizzler.SwizzleResultsDialog();
            }

            //Ok, do we at least have a TERRAIN satellite in orbit?
            else if (planetHasTerrainSat())
            {
                ScreenMessages.PostScreenMessage(kAnalysisUplink, kMessageDuration * 1.5f, ScreenMessageStyle.UPPER_CENTER);
            }

            else
            {
                ScreenMessages.PostScreenMessage(kNoScientistsOrTerrain, kMessageDuration * 1.5f, ScreenMessageStyle.UPPER_CENTER);
                return;
            }

            //Run the analysis
            biomeScanner.RunAnalysis();
        }