Exemple #1
0
 public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
 {
     return(MedicalRecipesUtility.GetFixedPartsToApplyOn(recipe, pawn, delegate(BodyPartRecord record)
     {
         if (!pawn.health.hediffSet.GetNotMissingParts().Contains(record))
         {
             return false;
         }
         if (pawn.health.hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(record))
         {
             return false;
         }
         return (!pawn.health.hediffSet.hediffs.Any((Hediff x) => x.Part == record && (x.def == recipe.addsHediff || !recipe.CompatibleWithHediff(x.def)))) ? true : false;
     }));
 }
        public static StatDrawEntry IncompatibleWithHediffTagsStat(RecipeDef surgery)
        {
            List <HediffDef> incompatibleHediffs = DefDatabase <HediffDef> .AllDefs.Where(hd => !surgery.CompatibleWithHediff(hd)).ToList();

            string title = "VariousLabel".Translate();

            if (incompatibleHediffs.Count <= 5)
            {
                title = string.Join("\n", incompatibleHediffs.Select(hd => hd.LabelCap));
            }

            return(new StatDrawEntry(
                       category:    category,
                       label:       "Stat_Recipe_Surgery_IncompatibleWithHediffTags_Name".Translate(),
                       reportText:  "Stat_Recipe_Surgery_IncompatibleWithHediffTags_Desc".Translate(),
                       valueString: title,
                       hyperlinks:  incompatibleHediffs.Select(hd => new Dialog_InfoCard.Hyperlink(hd)),
                       displayPriorityWithinCategory: 4870
                       ));
        }