void ProcessResources(VesselResources resources, BuildResourceSet report_resources, BuildResourceSet required_resources = null) { var reslist = resources.resources.Keys.ToList(); foreach (string res in reslist) { double amount = resources.ResourceAmount(res); var recipe = ExRecipeDatabase.ResourceRecipe(res); if (recipe != null) { double density = ExRecipeDatabase.ResourceDensity(res); double mass = amount * density; recipe = recipe.Bake(mass); foreach (var ingredient in recipe.ingredients) { var br = new BuildResource(ingredient); var resset = report_resources; if (required_resources != null) { resset = required_resources; } resset.Add(br); } } else { var br = new BuildResource(res, amount); report_resources.Add(br); } } }
void ProcessResource(VesselResources vr, string res, BuildResourceSet rd, bool xfer) { var amount = vr.ResourceAmount(res); var mass = amount * ExRecipeDatabase.ResourceDensity(res); ProcessIngredient(new Ingredient(res, mass), rd, xfer); }
void ProcessResources (VesselResources resources, BuildResourceSet report_resources, BuildResourceSet required_resources = null) { var reslist = resources.resources.Keys.ToList (); foreach (string res in reslist) { double amount = resources.ResourceAmount (res); var recipe = ExRecipeDatabase.ResourceRecipe (res); if (recipe != null) { double density = ExRecipeDatabase.ResourceDensity (res); double mass = amount * density; recipe = recipe.Bake (mass); foreach (var ingredient in recipe.ingredients) { var br = new BuildResource (ingredient); var resset = report_resources; if (required_resources != null) { resset = required_resources; } resset.Add (br); } } else { var br = new BuildResource (res, amount); report_resources.Add (br); } } }
internal void SetupCraftResources(Vessel vsl) { craftResources = new VesselResources(vsl); foreach (var br in buildCost.optional) { var amount = craftResources.ResourceAmount(br.name); craftResources.TransferResource(br.name, -amount); } }
internal void SetupCraftResources (Vessel vsl) { craftResources = new VesselResources (vsl); foreach (var br in buildCost.optional) { var amount = craftResources.ResourceAmount (br.name); craftResources.TransferResource (br.name, -amount); } }
double ProcessResources(VesselResources resources, List<BuildResource> report_resources) { double hullMass = 0; var reslist = resources.resources.Keys.ToList (); foreach (string res in reslist) { double amount = resources.ResourceAmount (res); var br = new BuildResource (res, amount); if (br.hull) { //FIXME better hull resources check hullMass += br.mass; } else { report_resources.Add (br); } } return hullMass; }
public float RecycleVessel(Vessel v) { float ConversionEfficiency = 0.8f; double amount; VesselResources scrap = new VesselResources (v); PartResourceDefinition rp_def; string target_resource = ExSettings.HullRecycleTarget; rp_def = PartResourceLibrary.Instance.GetDefinition (target_resource); if (FlightGlobals.ActiveVessel == v) FlightGlobals.ForceSetActiveVessel (this.vessel); float mass = 0; foreach (var crew in v.GetVesselCrew ()) { mass += RecycleKerbal (crew, null); } foreach (string resource in scrap.resources.Keys) { amount = scrap.ResourceAmount (resource); mass += ReclaimResource (resource, amount, v.name); scrap.TransferResource (resource, -amount); } float hull_mass = v.GetTotalMass (); amount = hull_mass * ConversionEfficiency / rp_def.density; mass += ReclaimResource (target_resource, amount, v.name, String.Format ("hull({0})", target_resource)); v.Die (); return mass; }
void ProcessResource (VesselResources vr, string res, BuildResourceSet rd, bool xfer) { var amount = vr.ResourceAmount (res); var mass = amount * ExRecipeDatabase.ResourceDensity (res); ProcessIngredient (new Ingredient (res, mass), rd, xfer); }