public static void DisplayHarvesterModule(ModuleResourceHarvester_USI harvester, Vessel vessel, Part part, BestCrewSkillLevels bestCrewSkillLevels)
        {
            if (!harvester.IsActivated)
            {
                PrintLine(20, harvester.ResourceName + ": Not activated");
                return;
            }
            PrintLine(20, harvester.ResourceName + ": Activated");

            // For debug
            //Line("EfficiencyMultiplier", harvester.GetEfficiencyMultiplier().ToString()); // thermal eff * eff due to specialist
            //Line("res status", harvester.ResourceStatus.ToString()); x/sec displayed by KSP. trash
            //Line("eff bonus", harvester.GetEfficiencyBonus().ToString()); // same a SwapBay ?

            SpecialistBonusExplanation specBonus = harvester.UseSpecialistBonus ? new SpecialistBonusExplanation(
                harvester.SpecialistBonusBase,
                harvester.SpecialistEfficiencyFactor,
                harvester.ExperienceEffect,
                bestCrewSkillLevels) : null;

            ExplainHarvester(
                harvester,
                part,
                harvester.ResourceName,
                ResourceCache.GetAbundance(harvester.ResourceName, vessel),
                harvester.GetCoreTemperature(),
                harvester.ThermalEfficiency.maxTime,
                harvester.ThermalEfficiency.Evaluate((float)harvester.GetCoreTemperature()),
                harvester.Efficiency,
                specBonus,
                vessel,
                bestCrewSkillLevels);
        }
Exemple #2
0
        public static void DisplayConverterModule(ModuleResourceConverter_USI converter, Vessel vessel, Part part, BestCrewSkillLevels bestCrewSkillLevels)
        {
            if (!converter.IsActivated)
            {
                PrintLine(20, converter.ConverterName + ": Not activated");
                return;
            }
            if (typeof(ModuleEfficiencyPart).IsInstanceOfType(converter))
            {
                PrintLine(20, converter.ConverterName + ": Active effiency part (not a real converter)");
                return;
            }
            if (typeof(ModuleHabitation).IsInstanceOfType(converter))
            {
                PrintLine(20, converter.ConverterName + ": Active hab part (not a real converter)");
                return;
            }
            PrintLine(20, converter.ConverterName + ": Activated");

            var tot = 1d;
            var totFactorsExplanation = new List <string>();

            if (converter.UseSpecialistBonus)
            {
                SpecialistBonusExplanation specBonus = new SpecialistBonusExplanation(
                    converter.SpecialistBonusBase,
                    converter.SpecialistEfficiencyFactor,
                    converter.ExperienceEffect,
                    bestCrewSkillLevels);
                PrintLine(40, "Specialist bonus", String.Format("{0:0.##}", specBonus.GetValue()), specBonus.Explain());
                tot *= specBonus.GetValue();
                totFactorsExplanation.Add("spec_bonus");
            }

            AddRequiredResourcesFactors(converter.reqList, part, ref tot, totFactorsExplanation);

            AddMksModuleFactors(converter, vessel, part, bestCrewSkillLevels, ref tot, totFactorsExplanation);

            var totExplanation = String.Join(" * ", totFactorsExplanation.ToArray());

            PrintLine(40, " -> Total load", String.Format("{0:0.##%}", tot), totExplanation);
            PrintResourceRates(60, tot, converter);
        }
        private static void ExplainHarvester(
            ModuleResourceHarvester_USI harvester,
            Part part,
            string resourceName,
            float locationResourceAbundance,
            double partTemperature,
            float maxTemp,
            float thermalEfficiency,
            float extractionAbundanceMultiplier,
            SpecialistBonusExplanation specialistBonus,
            Vessel vessel,
            BestCrewSkillLevels bestCrewSkillLevels)
        {
            var tot = 1d;
            var totFactorsExplanation = new List <string>();


            PrintLine(50, "Resource abundance at location", String.Format("{0}", locationResourceAbundance));
            PrintLine(50, "Harvester abundance multiplier", String.Format("\"{0}% base efficiency\"", extractionAbundanceMultiplier * 100));
            PrintLine(50, " -> Rate", String.Format("\"{0}/s\"", extractionAbundanceMultiplier * locationResourceAbundance));

            PrintLine(50, "\"Core Temperature\"", String.Format("{0:0.00}", partTemperature));
            // PrintLine(50, "Max temperature", String.Format("{0:0.00}", maxTemp));
            PrintLine(50, " -> \"Thermal Efficiency\"", String.Format("{0}%", 100 * thermalEfficiency), "(from some curves)");
            tot *= thermalEfficiency;
            totFactorsExplanation.Add("ThermalEfficiency");

            if (specialistBonus != null)
            {
                PrintLine(50, "Specialist bonus", String.Format("{0:0.##}", specialistBonus.GetValue()), specialistBonus.Explain());
                tot *= specialistBonus.GetValue();
                totFactorsExplanation.Add("SpecialistBonus");
            }

            AddMksModuleFactors(harvester, vessel, part, bestCrewSkillLevels, ref tot, totFactorsExplanation);

            var totExplanation = String.Join(" * ", totFactorsExplanation.ToArray());

            PrintLine(50, " -> Total load", String.Format("{0:0.##%}", tot), totExplanation);

            PrintLine(50, " -> Actual obtention rate", String.Format("+{0}/s", FormatResourceRate(tot * extractionAbundanceMultiplier * locationResourceAbundance)), "Rate * load");
            PrintSingleResourceRate(60, resourceName, "+", tot * extractionAbundanceMultiplier * locationResourceAbundance);
        }
Exemple #4
0
        private static double GetEffPartContribution(Part ep, ModuleEfficiencyPart epm, BestCrewSkillLevels bestCrewSkillLevels, float geoBonus, KolonyVessel effPartVessel)
        {
            var otherVesselExplanation = effPartVessel.ExplainOther();

            PrintLine(60, String.Format("Active {0} in {1}{2}", epm.ConverterName, Misc.Name(ep), otherVesselExplanation));
            var totEff = 1d;

            if (typeof(ModuleEfficiencyPart).GetField("Governor") != null)
            {
                var gov = (float)typeof(ModuleEfficiencyPart).GetField("Governor").GetValue(epm);
                PrintLine(80, "Governor", String.Format("{0:0.##}", gov));
                totEff *= gov;
            }
            if (epm.UseSpecialistBonus)
            {
                SpecialistBonusExplanation specBonus = new SpecialistBonusExplanation(
                    epm.SpecialistBonusBase,
                    epm.SpecialistEfficiencyFactor,
                    epm.ExperienceEffect,
                    bestCrewSkillLevels);
                PrintLine(80, "Crew bonus", String.Format("{0:0.##}", specBonus.GetValue()), specBonus.Explain());
                totEff *= specBonus.GetValue();
            }
            if (epm.reqList != null)
            {
                foreach (var res in epm.reqList)
                {
                    var amountInPart = ep.Resources[res.ResourceName].amount;
                    var bonus        = amountInPart / res.Ratio;
                    PrintLine(80, res.ResourceName, String.Format("{0:0.##}", bonus), String.Format("{0:0.##}/{1:0.##}", amountInPart, res.Ratio));
                    totEff *= bonus;
                }
            }
            {
                PrintLine(80, "Bonus", String.Format("{0:0.##}", epm.EfficiencyBonus), "bays");
                totEff *= epm.EfficiencyBonus;
            }
            PrintLine(80, "eMultiplier", String.Format("{0}", epm.eMultiplier)); // 0.83
            PrintLine(80, " -> Total contribution", String.Format("{0:0.##}", epm.eMultiplier * totEff));
            return(epm.eMultiplier * totEff);
        }
Exemple #5
0
        public static void DisplayConverterModule(ModuleBulkConverter converter, Vessel vessel, Part part, BestCrewSkillLevels bestCrewSkillLevels)
        {
            if (!converter.IsActivated)
            {
                PrintLine(20, converter.ConverterName + ": Not activated");
                return;
            }
            PrintLine(20, converter.ConverterName + ": Activated");

            var tot = 1d;
            var totFactorsExplanation = new List <string>();

            if (converter.UseSpecialistBonus)
            {
                SpecialistBonusExplanation specBonus = new SpecialistBonusExplanation(
                    converter.SpecialistBonusBase,
                    converter.SpecialistEfficiencyFactor,
                    converter.ExperienceEffect,
                    bestCrewSkillLevels);
                PrintLine(40, "Specialist bonus", String.Format("{0:0.##}", specBonus.GetValue()), specBonus.Explain());
                tot *= specBonus.GetValue();
                totFactorsExplanation.Add("spec_bonus");
            }

            AddRequiredResourcesFactors(converter.reqList, part, ref tot, totFactorsExplanation);

            AddMksModuleFactors(converter, vessel, part, bestCrewSkillLevels, ref tot, totFactorsExplanation);

            var totExplanation = String.Join(" * ", totFactorsExplanation.ToArray());

            PrintLine(40, " -> Total load", String.Format("{0:0.##%}", tot), totExplanation);

            Dictionary <string, double> resourceYields = GetResourceYields(vessel.mainBody.flightGlobalsIndex, converter.Yield, converter.MinAbundance, converter.inputList);
            List <ResourceRatio>        actualOutputs  = GetOutputs(resourceYields, converter.outputList);

            PrintResourceRates(60, tot, converter.inputList, actualOutputs);
        }