private void UpdateDrawerList()
        {
            _badBills.Clear();

            foreach (var thing in Find.CurrentMap.listerThings.ThingsMatching(
                         ThingRequest.ForGroup(ThingRequestGroup.PotentialBillGiver)))
            {
                if (thing is IBillGiver billGiver)
                {
                    foreach (var bill in billGiver.BillStack.Bills)
                    {
                        var billProduction = bill as Bill_Production;
                        if (billProduction == null || billProduction.suspended || !billProduction.ShouldDoNow() ||
                            billProduction.repeatMode == BillRepeatModeDefOf.Forever)
                        {
                            continue;
                        }

                        var notAllowedCounts = BillRequirementsMod.GetNotAllowedCount(bill).ToList();
                        if (notAllowedCounts.Any())
                        {
                            _badBills.Add(new BadBill {
                                Building         = thing,
                                Bill             = billProduction,
                                ProducedThingDef = billProduction.recipe.ProducedThingDef,
                                BillName         = $"{thing.LabelCap}: {bill.LabelCap}",
                                NotResolvedIngs  = notAllowedCounts
                            });
                        }
                    }
                }
            }
        }
Пример #2
0
        private static bool Prefix(ref string __result, RecipeDef r, IngredientCount ing)
        {
            __result = "BillRequiresNutrition"
                       .Translate(ing.GetBaseCount() + BillRequirementsMod.GetMaxAllowedCount(r, ing, true))
                       + " (" + ing.filter.Summary + ")";

            return(false);
        }
Пример #3
0
        private static bool Prefix(ref string __result, RecipeDef r, IngredientCount ing)
        {
            if (!ing.filter.AllowedThingDefs.Any(td => td.smallVolume) ||
                ing.filter.AllowedThingDefs.Any(td =>
                                                td.smallVolume && !r.GetPremultipliedSmallIngredients().Contains(td)))
            {
                __result = "BillRequires"
                           .Translate(ing.GetBaseCount(),
                                      ing.filter.Summary + BillRequirementsMod.GetMaxAllowedCount(r, ing, false)
                                      );

                return(false);
            }

            __result = "BillRequires"
                       .Translate(ing.GetBaseCount() * 10f,
                                  ing.filter.Summary + BillRequirementsMod.GetMaxAllowedCount(r, ing, false)
                                  );

            return(false);
        }