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 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 ProcessIngredient(Ingredient ingredient, BuildResourceSet rd, bool xfer) { var res = ingredient.name; Recipe recipe = null; // If the resource is being transfered from a tank (rather than // coming from the part body itself), then a transfer recipe will // override a recycle recipe if (xfer) { recipe = ExRecipeDatabase.TransferRecipe(res); } if (recipe == null) { recipe = ExRecipeDatabase.RecycleRecipe(res); } if (recipe != null) { recipe = recipe.Bake(ingredient.ratio); foreach (var ing in recipe.ingredients) { if (ing.isReal) { var br = new BuildResource(ing); rd.Add(br); } } } else { if (ExRecipeDatabase.ResourceRecipe(res) != null) { } else { if (ingredient.isReal) { var br = new BuildResource(ingredient); rd.Add(br); } } } }
void ProcessIngredient (Ingredient ingredient, BuildResourceSet rd, bool xfer) { var res = ingredient.name; Recipe recipe = null; // If the resource is being transfered from a tank (rather than // coming from the part body itself), then a transfer recipe will // override a recycle recipe if (xfer) { recipe = ExRecipeDatabase.TransferRecipe (res); } if (recipe == null) { recipe = ExRecipeDatabase.RecycleRecipe (res); } if (recipe != null) { recipe = recipe.Bake (ingredient.ratio); foreach (var ing in recipe.ingredients) { if (ing.isReal) { var br = new BuildResource (ing); rd.Add (br); } } } else { if (ExRecipeDatabase.ResourceRecipe (res) != null) { } else { if (ingredient.isReal) { var br = new BuildResource (ingredient); rd.Add (br); } } } }