Exemple #1
0
 public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
 {
     return(MedicalRecipesUtility.GetFixedPartsToApplyOn(recipe, pawn, delegate(BodyPartRecord record)
     {
         IEnumerable <Hediff> alreadyPresent = from x in pawn.health.hediffSet.hediffs
                                               where x.Part == record
                                               where x.def == recipe.addsHediff
                                               select x;
         return // hediff not already present
         !alreadyPresent.Any()
         // has something to attach to
         && (record.parent == null || pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null).Contains(record.parent))
         // is compatible with parent
         && !recipe.HasRestrictionsForPart(record, pawn.health.hediffSet)
         // part shouldn't be ignored
         && !pawn.health.hediffSet.PartShouldBeIgnored(record);
     }));
 }
Exemple #2
0
        public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
        {
            // don't add natural parts to prosthetics

            return
                (MedicalRecipesUtility.GetFixedPartsToApplyOn(recipe, pawn,
                                                              ( BodyPartRecord record ) =>
                                                              // part has some hediff
                                                              pawn.health.hediffSet.hediffs.Any(( Hediff x ) => x.Part == record)
                                                              // parent is not missing
                                                              && (record.parent == null || pawn.health.hediffSet.GetNotMissingParts().Contains(record.parent))
                                                              // parent is not an added part or is not solid (mainly for mutant arms and legs)
                                                              && (record.parent == null || !pawn.health.hediffSet.HasDirectlyAddedPartFor(record.parent) || !record.parent.def.IsSolid(record.parent, pawn.health.hediffSet.hediffs))
                                                              // is compatible with parent
                                                              && !recipe.HasRestrictionsForPart(record, pawn.health.hediffSet)
                                                              // part shouldn't be ignored
                                                              && !pawn.health.hediffSet.PartShouldBeIgnored(record)));
        }