Ejemplo n.º 1
0
  static void render_habitat(Panel p, Vessel v, vessel_info vi)
  {
    // if habitat feature is disabled, do not show the panel
    if (!Features.Habitat) return;

    // if vessel is unmanned, do not show the panel
    if (vi.crew_count == 0) return;

    // determine some content, with colors
    string pressure_str = Lib.Color(Lib.HumanReadablePressure(vi.pressure * Sim.PressureAtSeaLevel()), vi.pressure < Settings.PressureThreshold, "yellow");
    string poisoning_str = Lib.Color(Lib.HumanReadablePerc(vi.poisoning, "F2"), vi.poisoning > Settings.PoisoningThreshold * 0.5, "yellow");

    // render panel, add some content based on enabled features
    if (!v.isEVA)
    {
      p.section("HABITAT");
      if (Features.Pressure) p.content("pressure", pressure_str);
      if (Features.Poisoning) p.content("co2 level", poisoning_str);
      if (Features.Shielding) p.content("shielding", Habitat.shielding_to_string(vi.shielding));
      if (Features.LivingSpace) p.content("living space", Habitat.living_space_to_string(vi.living_space));
      if (Features.Comfort) p.content("comfort", vi.comforts.summary(), vi.comforts.tooltip());
    }
    else
    {
      p.section("HABITAT");
      if (Features.Poisoning) p.content("co2 level", poisoning_str);
    }
  }
Ejemplo n.º 2
0
        // specifics support
        public Specifics Specs()
        {
            Specifics specs = new Specifics();

            specs.add("Havest size", Lib.HumanReadableAmount(crop_size, " " + crop_resource));
            specs.add("Harvest time", Lib.HumanReadableDuration(1.0 / crop_rate));
            specs.add("Lighting tolerance", Lib.HumanReadableFlux(light_tolerance));
            if (pressure_tolerance > double.Epsilon)
            {
                specs.add("Pressure tolerance", Lib.HumanReadablePressure(Sim.PressureAtSeaLevel() * pressure_tolerance));
            }
            if (radiation_tolerance > double.Epsilon)
            {
                specs.add("Radiation tolerance", Lib.HumanReadableRadiation(radiation_tolerance));
            }
            specs.add("Lamps EC rate", Lib.HumanReadableRate(ec_rate));
            specs.add(string.Empty);
            specs.add("<color=#00ffff>Required resources</color>");
            foreach (ModuleResource input in resHandler.inputResources)
            {
                specs.add(input.name, Lib.BuildString("<color=#ff0000>", Lib.HumanReadableRate(input.rate), "</color>"));
            }
            specs.add(string.Empty);
            specs.add("<color=#00ffff>By-products</color>");
            foreach (ModuleResource output in resHandler.outputResources)
            {
                specs.add(output.name, Lib.BuildString("<color=#00ff00>", Lib.HumanReadableRate(output.rate), "</color>"));
            }
            return(specs);
        }
Ejemplo n.º 3
0
        // specifics support
        public Specifics Specs()
        {
            Specifics specs = new Specifics();

            specs.Add("Harvest size", Lib.HumanReadableAmount(crop_size, " " + crop_resource));
            specs.Add("Harvest time", Lib.HumanReadableDuration(1.0 / crop_rate));
            specs.Add("Lighting tolerance", Lib.HumanReadableFlux(light_tolerance));
            if (pressure_tolerance > double.Epsilon)
            {
                specs.Add("Pressure tolerance", Lib.HumanReadablePressure(Sim.PressureAtSeaLevel() * pressure_tolerance));
            }
            if (radiation_tolerance > double.Epsilon)
            {
                specs.Add("Radiation tolerance", Lib.HumanReadableRadiation(radiation_tolerance));
            }
            specs.Add("Lamps EC rate", Lib.HumanReadableRate(ec_rate));
            specs.Add(string.Empty);
            specs.Add("<color=#00ffff>Required resources</color>");

            // do we have combined WasteAtmosphere and CO2
            Set_WACO2();
            bool dis_WACO2 = false;

            foreach (ModuleResource input in resHandler.inputResources)
            {
                // combine WasteAtmosphere and CO2 if both exist
                if (WACO2 && (input.name == "WasteAtmosphere" || input.name == "CarbonDioxide"))
                {
                    if (dis_WACO2)
                    {
                        continue;
                    }
                    ModuleResource sec;
                    if (input.name == "WasteAtmosphere")
                    {
                        sec = resHandler.inputResources.Find(x => x.name.Contains("CarbonDioxide"));
                    }
                    else
                    {
                        sec = resHandler.inputResources.Find(x => x.name.Contains("WasteAtmosphere"));
                    }
                    specs.Add("CarbonDioxide", Lib.BuildString("<color=#ffaa00>", Lib.HumanReadableRate(input.rate + sec.rate), "</color>"));
                    specs.Add("Crops can also use the CO2 in the atmosphere without a scrubber.");
                    dis_WACO2 = true;
                }
                else
                {
                    specs.Add(input.name, Lib.BuildString("<color=#ffaa00>", Lib.HumanReadableRate(input.rate), "</color>"));
                }
            }
            specs.Add(string.Empty);
            specs.Add("<color=#00ffff>By-products</color>");
            foreach (ModuleResource output in resHandler.outputResources)
            {
                specs.Add(output.name, Lib.BuildString("<color=#00ff00>", Lib.HumanReadableRate(output.rate), "</color>"));
            }
            return(specs);
        }
Ejemplo n.º 4
0
		// specifics support
		public Specifics Specs()
		{
			Specifics specs = new Specifics();
			specs.add("type", ((HarvestTypes)type).ToString());
			specs.add("resource", resource);
			if (min_abundance > double.Epsilon) specs.add("min abundance", Lib.HumanReadablePerc(min_abundance, "F2"));
			if (type == 2 && min_pressure > double.Epsilon) specs.add("min pressure", Lib.HumanReadablePressure(min_pressure));
			specs.add("extraction rate", Lib.HumanReadableRate(rate));
			if (ec_rate > double.Epsilon) specs.add("ec consumption", Lib.HumanReadableRate(ec_rate));
			return specs;
		}
Ejemplo n.º 5
0
        // get readings short text info
        public static string telemetry_content(Vessel v, vessel_info vi, string type)
        {
            switch (type)
            {
            case "temperature":   return(Lib.HumanReadableTemp(vi.temperature));

            case "radiation":     return(Lib.HumanReadableRadiation(vi.radiation));

            case "pressure":      return(Lib.HumanReadablePressure(v.mainBody.GetPressure(v.altitude)));

            case "gravioli":      return(vi.gravioli < 0.33 ? "nothing here" : vi.gravioli < 0.66 ? "almost one" : "WOW!");
            }
            return(string.Empty);
        }
Ejemplo n.º 6
0
        static void Render_habitat(Panel p, Vessel v, VesselData vd)
        {
            // if habitat feature is disabled, do not show the panel
            if (!Features.Habitat)
            {
                return;
            }

            // if vessel is unmanned, do not show the panel
            if (vd.CrewCount == 0)
            {
                return;
            }

            // render panel, add some content based on enabled features
            p.AddSection("HABITAT");
            if (Features.Poisoning)
            {
                p.AddContent("co2 level", Lib.Color(vd.Poisoning > Settings.PoisoningThreshold, Lib.HumanReadablePerc(vd.Poisoning, "F2"), Lib.Kolor.Yellow));
            }
            if (Features.Radiation && v.isEVA)
            {
                p.AddContent("radiation", Lib.HumanReadableRadiation(vd.EnvHabitatRadiation));
            }

            if (!v.isEVA)
            {
                if (Features.Pressure)
                {
                    p.AddContent("pressure", Lib.HumanReadablePressure(vd.Pressure * Sim.PressureAtSeaLevel()));
                }
                if (Features.Shielding)
                {
                    p.AddContent("shielding", Habitat.Shielding_to_string(vd.Shielding));
                }
                if (Features.LivingSpace)
                {
                    p.AddContent("living space", Habitat.Living_space_to_string(vd.LivingSpace));
                }
                if (Features.Comfort)
                {
                    p.AddContent("comfort", vd.Comforts.Summary(), vd.Comforts.Tooltip());
                }
                if (Features.Pressure)
                {
                    p.AddContent("EVA's available", vd.EnvBreathable ? "infinite" : Lib.HumanReadableInteger(vd.Evas), vd.EnvBreathable ? "breathable atmosphere" : "approx (derived from stored N2)");
                }
            }
        }
Ejemplo n.º 7
0
        static void Render_habitat(Panel p, Vessel v, Vessel_info vi)
        {
            // if habitat feature is disabled, do not show the panel
            if (!Features.Habitat)
            {
                return;
            }

            // if vessel is unmanned, do not show the panel
            if (vi.crew_count == 0)
            {
                return;
            }

            // render panel, add some content based on enabled features
            p.AddSection("HABITAT");
            if (Features.Poisoning)
            {
                p.AddContent("co2 level", Lib.Color(Lib.HumanReadablePerc(vi.poisoning, "F2"), vi.poisoning > Settings.PoisoningThreshold, "yellow"));
            }
            if (!v.isEVA)
            {
                if (Features.Humidity)
                {
                    p.AddContent("humidity", Lib.Color(Lib.HumanReadablePerc(vi.humidity, "F2"), vi.humidity > Settings.HumidityThreshold, "yellow"));
                }
                if (Features.Pressure)
                {
                    p.AddContent("pressure", Lib.HumanReadablePressure(vi.pressure * Sim.PressureAtSeaLevel()));
                }
                if (Features.Shielding)
                {
                    p.AddContent("shielding", Habitat.Shielding_to_string(vi.shielding));
                }
                if (Features.LivingSpace)
                {
                    p.AddContent("living space", Habitat.Living_space_to_string(vi.living_space));
                }
                if (Features.Comfort)
                {
                    p.AddContent("comfort", vi.comforts.Summary(), vi.comforts.Tooltip());
                }
                if (Features.Pressure)
                {
                    p.AddContent("EVA's available", vi.breathable ? "infinite" : Lib.HumanReadableInteger(vi.evas), vi.breathable ? "breathable atmosphere" : "approx (derived from stored N2)");
                }
            }
        }
Ejemplo n.º 8
0
        // get readings short text info
        public static string Telemetry_content(Vessel v, VesselData vd, string type)
        {
            switch (type)
            {
            case "temperature": return(Lib.HumanReadableTemp(vd.EnvTemperature));

            case "radiation": return(Lib.HumanReadableRadiation(vd.EnvRadiation));

            case "habitat_radiation": return(Lib.HumanReadableRadiation(HabitatRadiation(vd)));

            case "pressure": return(Lib.HumanReadablePressure(v.mainBody.GetPressure(v.altitude)));

            case "gravioli": return(vd.EnvGravioli < 0.33 ? Local.Sensor_shorttextinfo1 : vd.EnvGravioli < 0.66 ? Local.Sensor_shorttextinfo2 : Local.Sensor_shorttextinfo3);                   //"nothing here""almost one""WOW!"
            }
            return(string.Empty);
        }
Ejemplo n.º 9
0
        static void Render_Habitat(Panel p, Vessel v, Vessel_Info vi)
        {
            // if habitat feature is disabled, do not show the panel
            if (!Features.Habitat)
            {
                return;
            }

            // if vessel is unmanned, do not show the panel
            if (vi.crew_count == 0)
            {
                return;
            }

            // render panel, add some content based on enabled features
            p.SetSection("HABITAT");
            if (Features.Poisoning)
            {
                p.SetContent("co2 level", Lib.Color(Lib.HumanReadablePerc(vi.poisoning, "F2"), vi.poisoning > Settings.PoisoningThreshold, "yellow"));
            }
            if (!v.isEVA)
            {
                if (Features.Pressure)
                {
                    p.SetContent("pressure", Lib.HumanReadablePressure(vi.pressure * Sim.PressureAtSeaLevel()));
                }
                if (Features.Shielding)
                {
                    p.SetContent("shielding", Lib.HumanReadableShielding(vi.shielding));
                }
                if (Features.LivingSpace)
                {
                    p.SetContent("living space", Habitat.Living_Space_to_String(vi.living_space));
                }
                if (Features.Comfort)
                {
                    p.SetContent("comfort", vi.comforts.Summary(), vi.comforts.Tooltip());
                }
            }
        }
Ejemplo n.º 10
0
        // specifics support
        public Specifics Specs()
        {
            Specifics specs = new Specifics();

            specs.Add(Local.Harvester_info1, ((HarvestTypes)type).ToString()); //"type"
            specs.Add(Local.Harvester_info2, resource);                        //"resource"
            if (min_abundance > double.Epsilon)
            {
                specs.Add(Local.Harvester_info3, Lib.HumanReadablePerc(min_abundance, "F2"));                                            //"min abundance"
            }
            if (type == 2 && min_pressure > double.Epsilon)
            {
                specs.Add(Local.Harvester_info4, Lib.HumanReadablePressure(min_pressure)); //"min pressure"
            }
            specs.Add(Local.Harvester_info5, Lib.HumanReadableRate(rate));                 //"extraction rate"
            specs.Add(Local.Harvester_info6, Lib.HumanReadablePerc(abundance_rate, "F2")); //"at abundance"
            if (ec_rate > double.Epsilon)
            {
                specs.Add(Local.Harvester_info7, Lib.HumanReadableRate(ec_rate));                                      //"ec consumption"
            }
            return(specs);
        }
Ejemplo n.º 11
0
        public static string RequirementText(string requirement)
        {
            var parts = Lib.Tokenize(requirement, ':');

            var    condition = parts[0];
            string value     = string.Empty;

            if (parts.Count > 1)
            {
                value = parts[1];
            }

            switch (condition)
            {
            case "OrbitMinInclination": return(Lib.BuildString("Min. inclination ", value, "°"));

            case "OrbitMaxInclination": return(Lib.BuildString("Max. inclination ", value, "°"));

            case "OrbitMinEccentricity": return(Lib.BuildString("Min. eccentricity ", value));

            case "OrbitMaxEccentricity": return(Lib.BuildString("Max. eccentricity ", value));

            case "OrbitMinArgOfPeriapsis": return(Lib.BuildString("Min. argument of Pe ", value));

            case "OrbitMaxArgOfPeriapsis": return(Lib.BuildString("Max. argument of Pe ", value));

            case "AltitudeMin": return(Lib.BuildString("Min. altitude ", Lib.HumanReadableRange(Double.Parse(value))));

            case "AltitudeMax":
                var v = Double.Parse(value);
                if (v >= 0)
                {
                    return(Lib.BuildString("Max. altitude ", Lib.HumanReadableRange(v)));
                }
                return(Lib.BuildString("Min. depth ", Lib.HumanReadableRange(-v)));

            case "RadiationMin": return(Lib.BuildString("Min. radiation ", Lib.HumanReadableRadiation(Double.Parse(value))));

            case "RadiationMax": return(Lib.BuildString("Max. radiation ", Lib.HumanReadableRadiation(Double.Parse(value))));

            case "Body": return(PrettyBodyText(value));

            case "TemperatureMin": return(Lib.BuildString("Min. temperature ", Lib.HumanReadableTemp(Double.Parse(value))));

            case "TemperatureMax": return(Lib.BuildString("Max. temperature ", Lib.HumanReadableTemp(Double.Parse(value))));

            case "CrewMin": return(Lib.BuildString("Min. crew ", value));

            case "CrewMax": return(Lib.BuildString("Max. crew ", value));

            case "CrewCapacityMin": return(Lib.BuildString("Min. crew capacity ", value));

            case "CrewCapacityMax": return(Lib.BuildString("Max. crew capacity ", value));

            case "VolumePerCrewMin": return(Lib.BuildString("Min. vol./crew ", Lib.HumanReadableVolume(double.Parse(value))));

            case "VolumePerCrewMax": return(Lib.BuildString("Max. vol./crew ", Lib.HumanReadableVolume(double.Parse(value))));

            case "MaxAsteroidDistance": return(Lib.BuildString("Max. asteroid distance ", Lib.HumanReadableRange(double.Parse(value))));

            case "SunAngleMin": return(Lib.BuildString("Min. sun angle ", Lib.HumanReadableAngle(double.Parse(value))));

            case "SunAngleMax": return(Lib.BuildString("Max. sun angle ", Lib.HumanReadableAngle(double.Parse(value))));

            case "AtmosphereBody": return("Body with atmosphere");

            case "AtmosphereAltMin": return(Lib.BuildString("Min. atmosphere altitude ", value));

            case "AtmosphereAltMax": return(Lib.BuildString("Max. atmosphere altitude ", value));

            case "SurfaceSpeedMin": return(Lib.BuildString("Min. surface speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "SurfaceSpeedMax": return(Lib.BuildString("Max. surface speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "VerticalSpeedMin": return(Lib.BuildString("Min. vertical speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "VerticalSpeedMax": return(Lib.BuildString("Max. vertical speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "SpeedMin": return(Lib.BuildString("Min. speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "SpeedMax": return(Lib.BuildString("Max. speed ", Lib.HumanReadableSpeed(double.Parse(value))));

            case "DynamicPressureMin": return(Lib.BuildString("Min. dynamic pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "DynamicPressureMax": return(Lib.BuildString("Max. dynamic pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "StaticPressureMin": return(Lib.BuildString("Min. pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "StaticPressureMax": return(Lib.BuildString("Max. pressure ", Lib.HumanReadablePressure(double.Parse(value))));

            case "AtmDensityMin": return(Lib.BuildString("Min. atm. density ", Lib.HumanReadablePressure(double.Parse(value))));

            case "AtmDensityMax": return(Lib.BuildString("Max. atm. density ", Lib.HumanReadablePressure(double.Parse(value))));

            case "AltAboveGroundMin": return(Lib.BuildString("Min. ground altitude ", Lib.HumanReadableRange(double.Parse(value))));

            case "AltAboveGroundMax": return(Lib.BuildString("Max. ground altitude ", Lib.HumanReadableRange(double.Parse(value))));

            case "MissionControlLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.MissionControl), " level ", value));

            case "MissionControlLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.MissionControl), " max. level ", value));

            case "AdministrationLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.Administration), " level ", value));

            case "AdministrationLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.Administration), " max. level ", value));

            case "TrackingStationLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.TrackingStation), " level ", value));

            case "TrackingStationLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.TrackingStation), " max. level ", value));

            case "AstronautComplexLevelMin": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.AstronautComplex), " level ", value));

            case "AstronautComplexLevelMax": return(Lib.BuildString(ScenarioUpgradeableFacilities.GetFacilityName(SpaceCenterFacility.AstronautComplex), " max. level ", value));

            case "Part": return(Lib.BuildString("Needs part ", value));

            case "Module": return(Lib.BuildString("Needs module ", value));

            default:
                return(Lib.SpacesOnCaps(condition));
            }
        }
Ejemplo n.º 12
0
        public static string ReqValueFormat(Require req, object reqValue)
        {
            switch (req)
            {
            case Require.OrbitMinEccentricity:
            case Require.OrbitMaxEccentricity:
            case Require.OrbitMinArgOfPeriapsis:
            case Require.OrbitMaxArgOfPeriapsis:
            case Require.AtmosphereAltMin:
            case Require.AtmosphereAltMax:
                return(((double)reqValue).ToString("F2"));

            case Require.SunAngleMin:
            case Require.SunAngleMax:
            case Require.OrbitMinInclination:
            case Require.OrbitMaxInclination:
                return(Lib.HumanReadableAngle((double)reqValue));

            case Require.TemperatureMin:
            case Require.TemperatureMax:
                return(Lib.HumanReadableTemp((double)reqValue));

            case Require.AltitudeMin:
            case Require.AltitudeMax:
            case Require.AltAboveGroundMin:
            case Require.AltAboveGroundMax:
            case Require.MaxAsteroidDistance:
                return(Lib.HumanReadableDistance((double)reqValue));

            case Require.RadiationMin:
            case Require.RadiationMax:
                return(Lib.HumanReadableRadiation((double)reqValue));

            case Require.VolumePerCrewMin:
            case Require.VolumePerCrewMax:
                return(Lib.HumanReadableVolume((double)reqValue));

            case Require.SurfaceSpeedMin:
            case Require.SurfaceSpeedMax:
            case Require.VerticalSpeedMin:
            case Require.VerticalSpeedMax:
            case Require.SpeedMin:
            case Require.SpeedMax:
                return(Lib.HumanReadableSpeed((double)reqValue));

            case Require.DynamicPressureMin:
            case Require.DynamicPressureMax:
            case Require.StaticPressureMin:
            case Require.StaticPressureMax:
            case Require.AtmDensityMin:
            case Require.AtmDensityMax:
                return(Lib.HumanReadablePressure((double)reqValue));

            case Require.CrewMin:
            case Require.CrewMax:
            case Require.CrewCapacityMin:
            case Require.CrewCapacityMax:
            case Require.AstronautComplexLevelMin:
            case Require.AstronautComplexLevelMax:
            case Require.TrackingStationLevelMin:
            case Require.TrackingStationLevelMax:
            case Require.MissionControlLevelMin:
            case Require.MissionControlLevelMax:
            case Require.AdministrationLevelMin:
            case Require.AdministrationLevelMax:
                return(((int)reqValue).ToString());

            case Require.Module:
                return(KSPUtil.PrintModuleName((string)reqValue));

            case Require.Part:
                return(PartLoader.getPartInfoByName((string)reqValue)?.title ?? (string)reqValue);

            default:
                return(string.Empty);
            }
        }