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);
                }
            }
        }
Esempio n. 2
0
        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);
        }
 public void addPart(Part part)
 {
     if (ExSettings.KIS_Present)
     {
         KIS.KISWrapper.GetResources(part, container.resources);
     }
     ExRecipeDatabase.ProcessPart(part, hullResoures.resources);
     resources.AddPart(part);
     mass += part.mass;
 }
Esempio n. 4
0
        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);
                    }
                }
            }
        }
Esempio n. 5
0
        void ProcessKerbal(ProtoCrewMember crew, BuildResourceSet rd)
        {
            string message = crew.name + " was mulched";

            ScreenMessages.PostScreenMessage(message, 30.0f, ScreenMessageStyle.UPPER_CENTER);

            var part_recipe = ExRecipeDatabase.KerbalRecipe();

            if (part_recipe == null)
            {
                return;
            }
            var kerbal_recipe = part_recipe.Bake(0.09375);             //FIXME

            for (int i = 0; i < kerbal_recipe.ingredients.Count; i++)
            {
                var ingredient = kerbal_recipe.ingredients[i];
                ProcessIngredient(ingredient, rd, false);
            }
            foreach (var br in rd.Values)
            {
                Debug.Log(String.Format("[EL RSM] ProcessKerbal: {0} {1} {2}", crew.name, br.name, br.amount));
            }
        }