public Recipe Bake(double mass)
        {
            var recipe = new Recipe();
            var prec   = part_recipe.Bake(mass);

            for (int i = 0; i < prec.ingredients.Count; i++)
            {
                var    pi = prec.ingredients[i];
                Recipe rec;
                if (pi.name == "structure")
                {
                    rec = structure_recipe;
                }
                else
                {
                    rec = ELRecipeDatabase.module_recipes[pi.name];
                }
                var subr = rec.Bake(pi.ratio);
                for (int j = 0; j < subr.ingredients.Count; j++)
                {
                    var si = subr.ingredients[j];
                    recipe.AddIngredient(subr.ingredients[j]);
                }
            }
            return(recipe);
        }
		public PartRecipe (ConfigNode recipe)
		{
			part_recipe = new Recipe (recipe);
			if (!part_recipe.HasIngredient ("structure")) {
				part_recipe.AddIngredient (new Ingredient ("structure", 5));
			}
			if (recipe.HasNode ("Resources")) {
				structure_recipe = new Recipe (recipe.GetNode ("Resources"));
			} else {
				structure_recipe = ExRecipeDatabase.default_structure_recipe;
			}
		}
 public PartRecipe(ConfigNode recipe)
 {
     part_recipe = new Recipe(recipe);
     if (!part_recipe.HasIngredient("structure"))
     {
         part_recipe.AddIngredient(new Ingredient("structure", 5));
     }
     if (recipe.HasNode("Resources"))
     {
         structure_recipe = new Recipe(recipe.GetNode("Resources"));
     }
     else
     {
         structure_recipe = ELRecipeDatabase.default_structure_recipe;
     }
 }
		public Recipe Bake (double mass)
		{
			var recipe = new Recipe ();
			var prec = part_recipe.Bake (mass);
			for (int i = 0; i < prec.ingredients.Count; i++) {
				var pi = prec.ingredients[i];
				Recipe rec;
				if (pi.name == "structure") {
					rec = structure_recipe;
				} else {
					rec = ExRecipeDatabase.module_recipes[pi.name];
				}
				var subr = rec.Bake (pi.ratio);
				for (int j = 0; j < subr.ingredients.Count; j++) {
					var si = subr.ingredients[j];
					recipe.AddIngredient (subr.ingredients[j]);
				}
			}
			return recipe;
		}
 void ExpandResourceRecipes(Recipe recipe)
 {
     for (int i = recipe.ingredients.Count; i-- > 0;)
     {
         Ingredient ingredient = recipe.ingredients[i];
         if (!ResourceDefined(ingredient.name))
         {
             var resRecipe = ELRecipeDatabase.ResourceRecipe(ingredient.name);
             if (resRecipe != null)
             {
                 resRecipe = resRecipe.Bake(ingredient.ratio);
                 resRecipe.ingredients[0].heat = ingredient.heat;
                 recipe.ingredients.RemoveAt(i);
                 for (int j = resRecipe.ingredients.Count; j-- > 0;)
                 {
                     recipe.AddIngredient(resRecipe.ingredients[j]);
                 }
             }
         }
     }
 }
 public PartRecipe()
 {
     part_recipe = new Recipe();
     part_recipe.AddIngredient(new Ingredient("structure", 5));
     structure_recipe = ELRecipeDatabase.default_structure_recipe;
 }
		public PartRecipe ()
		{
			part_recipe = new Recipe ();
			part_recipe.AddIngredient (new Ingredient ("structure", 5));
			structure_recipe = ExRecipeDatabase.default_structure_recipe;
		}