コード例 #1
0
            public RecipeEntry(Recipe recipe, bool isProduction, Goods currentItem, bool atCurrentMilestones)
            {
                this.recipe = recipe;
                var amount = isProduction ? recipe.GetProduction(currentItem) : recipe.GetConsumption(currentItem);

                recipeFlow         = recipe.ApproximateFlow(atCurrentMilestones);
                flow               = recipeFlow * amount;
                specificEfficiency = isProduction ? recipe.Cost() / amount : 0f;
                if (!recipe.IsAccessible())
                {
                    entryStatus = EntryStatus.NotAccessible;
                }
                else if (!recipe.IsAccessibleWithCurrentMilestones())
                {
                    entryStatus = EntryStatus.NotAccessibleWithCurrentMilestones;
                }
                else
                {
                    var waste = recipe.RecipeWaste(atCurrentMilestones);
                    if (recipe.specialType != FactorioObjectSpecialType.Normal && recipeFlow <= 0.01f)
                    {
                        entryStatus = EntryStatus.Special;
                    }
                    else if (waste > 0f)
                    {
                        entryStatus = EntryStatus.Normal;
                    }
                    else
                    {
                        entryStatus = EntryStatus.Useful;
                    }
                }
            }
コード例 #2
0
 public float GetRecipeFlow(Recipe recipe) => recipe.ApproximateFlow();