public static Thing SpawnNaturalPartIfClean(Pawn pawn, BodyPartRecord part, IntVec3 pos, Map map) { if (MedicalRecipesUtility.IsCleanAndDroppable(pawn, part)) { return(GenSpawn.Spawn(part.def.spawnThingOnRemoved, pos, map)); } return(null); }
public override IEnumerable <BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { IEnumerable <BodyPartRecord> parts = pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined); foreach (BodyPartRecord part in parts) { if (pawn.health.hediffSet.HasDirectlyAddedPartFor(part)) { yield return(part); } if (MedicalRecipesUtility.IsCleanAndDroppable(pawn, part)) { yield return(part); } if (part != pawn.RaceProps.body.corePart && !part.def.dontSuggestAmputation && pawn.health.hediffSet.hediffs.Any((Hediff d) => !(d is Hediff_Injury) && d.def.isBad && d.Visible && d.Part == part)) { yield return(part); } } }