protected static List <KolonyVessel> GetKolonyVessels(Vessel thisVessel, float range, bool includeThis = true, bool landedOnly = true) { List <KolonyVessel> res = new List <KolonyVessel>(); foreach (var v in LogisticsTools.GetNearbyVessels(range, includeThis, thisVessel, landedOnly)) { KolonyVessel item = new KolonyVessel(); item.name = Misc.Name(v); item.vessel = v; if (v == thisVessel) { item.thisVessel = true; } else { item.thisVessel = false; item.distance = LogisticsTools.GetRange(v, thisVessel); } res.Add(item); } return(res); }
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); }