예제 #1
0
 void BiomeParser(StringBuilder result, CommonInfo info, string[] args)
 {
     if (info.Vessel != null)
     {
         result.Append(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ScienceUtil.GetExperimentBiomeLocalized(info.Vessel.mainBody, info.Vessel.latitude, info.Vessel.longitude).ToLower()));
     }
 }
예제 #2
0
 void LandingZoneParser(StringBuilder result, CommonInfo info, string[] args)
 {
     if (info.Vessel != null)
     {
         string landedAt = (string.IsNullOrEmpty(info.Vessel.landedAt))
             ? ScienceUtil.GetExperimentBiomeLocalized(info.Vessel.mainBody, info.Vessel.latitude, info.Vessel.longitude)
             : Localizer.Format(info.Vessel.displaylandedAt); // http://forum.kerbalspaceprogram.com/threads/123896-Human-Friendly-Landing-Zone-Title
         result.Append(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(landedAt.ToLower()));
     }
 }
예제 #3
0
        public void FixedUpdate()
        {
            if (!HighLogic.LoadedSceneIsFlight || vessel == null || !vessel.loaded || vessel.situation != Vessel.Situations.PRELAUNCH)
            {
                return;
            }

            if (string.IsNullOrEmpty(LaunchSiteName))
            {
                string defaultSpaceCenter = Configuration.Instance.DefaultSpaceCenterName;
                string landedAt           = "";

                try
                {
                    landedAt = (string.IsNullOrEmpty(vessel.landedAt))
                    ? ScienceUtil.GetExperimentBiomeLocalized(vessel.mainBody, vessel.latitude, vessel.longitude)
                    : Localizer.Format(vessel.displaylandedAt); // http://forum.kerbalspaceprogram.com/threads/123896-Human-Friendly-Landing-Zone-Title

                    if (landedAt == localisedLaunchPad || landedAt == localisedRunway)
                    {
                        landedAt = kscDefaultName;
                    }
                }
                catch (Exception ex)
                {
                    Historian.Print("Exception parsing landedAt");
                    Historian.Print(ex.Message);
                }

                string switcherSite = CheckKSCswitcher();
                if (switcherSite != kscDefaultName)
                {
                    landedAt = switcherSite;
                }

                string kkSite = CheckKerbalKonstructs();
                if (kkSite != kscDefaultName)
                {
                    landedAt = kkSite;
                }

                if (landedAt == kscDefaultName)
                {
                    landedAt = defaultSpaceCenter;
                }

                LaunchSiteName = landedAt;
            }
        }
        private static string currentDisplayBiome(ScienceExperiment e, Vessel v)
        {
            if (e == null)
            {
                return("");
            }

            if (v == null)
            {
                return("");
            }

            if (!e.BiomeIsRelevantWhile(ExperimentSituations.SrfLanded))
            {
                return("");
            }

            if (string.IsNullOrEmpty(v.displaylandedAt))
            {
                return(Localizer.Format(ScienceUtil.GetExperimentBiomeLocalized(v.mainBody, v.latitude, v.longitude)));
            }

            return(Localizer.Format(v.displaylandedAt));
        }
예제 #5
0
 private static string GetBiome()
 {
     return(ScienceUtil.GetExperimentBiomeLocalized(FlightGlobals.ActiveVessel.mainBody, FlightGlobals.ActiveVessel.latitude, FlightGlobals.ActiveVessel.longitude));
 }
        //This method handles generating the surface or asteroid sample ScienceData
        private ScienceData sampleData(ModuleAsteroid m)
        {
            ScienceExperiment    exp = null;
            ScienceSubject       sub = null;
            ExperimentSituations expSit;
            ScienceData          data = null;
            string biome        = "";
            string displayBiome = "";

            if (m != null)
            {
                exp = asteroidExp;
            }
            else
            {
                exp = surfaceExp;
            }

            if (exp == null)
            {
                return(null);
            }

            expSit = ScienceUtil.GetExperimentSituation(vessel);

            if (exp.IsAvailableWhile(expSit, vessel.mainBody))
            {
                if (exp.BiomeIsRelevantWhile(expSit))
                {
                    if (!string.IsNullOrEmpty(vessel.landedAt))
                    {
                        biome        = Vessel.GetLandedAtString(vessel.landedAt);
                        displayBiome = Localizer.Format(vessel.displaylandedAt);
                    }
                    else
                    {
                        biome        = ScienceUtil.GetExperimentBiome(vessel.mainBody, vessel.latitude, vessel.longitude);
                        displayBiome = Localizer.Format(ScienceUtil.GetExperimentBiomeLocalized(vessel.mainBody, vessel.latitude, vessel.longitude));
                    }
                }

                if (m != null)
                {
                    sub = ResearchAndDevelopment.GetExperimentSubject(exp, expSit, m.part.partInfo.name + m.part.flightID, m.part.partInfo.title, vessel.mainBody, biome, displayBiome);
                }
                else
                {
                    sub = ResearchAndDevelopment.GetExperimentSubject(exp, expSit, vessel.mainBody, biome, displayBiome);
                }

                if (sub == null)
                {
                    return(null);
                }

                data = new ScienceData(exp.baseValue * exp.dataScale, this.xmitDataScalar, 0f, sub.id, sub.title, false, part.flightID);

                return(data);
            }

            return(null);
        }