public static bool TryGetParts(Corpse corpse, RecipeInfo recipeInfo, BodyPartRecord part, float skillChance, ref List <Thing> result, ref List <BodyPartRecord> damagedParts) { if (IsCleanAndDroppable(corpse.InnerPawn, part)) { damagedParts.Add(part); CompRottable rot = corpse.TryGetComp <CompRottable>(); if (rot == null ? corpse.Age <= recipeInfo.CorpseValidAge : rot.RotProgress + (corpse.Age - rot.RotProgress) * recipeInfo.FrozenDecay <= recipeInfo.CorpseValidAge) { if (Rand.Chance(Math.Min(skillChance, recipeInfo.NaturalChance))) { result.Add(ThingMaker.MakeThing(part.def.spawnThingOnRemoved)); } return(true); } } List <Hediff> bion = corpse.InnerPawn.health.hediffSet.hediffs.Where(x => part.Equals(x.Part) && x.def.spawnThingOnRemoved != null && (x is Hediff_Implant || x is Hediff_AddedPart)).ToList(); if (bion.Count > 0) { result.AddRange(bion.Where(x => Rand.Chance(Math.Min(skillChance, recipeInfo.BionicChance))) .Select(x => ThingMaker.MakeThing(x.def.spawnThingOnRemoved))); damagedParts.Add(part); return(true); } return(false); }
public bool CanGetPart(Pawn pawn, BodyPartRecord part, bool notRotten) { if (!animal && notRotten) { if (NewMedicalRecipesUtility.IsCleanAndDroppable(pawn, part)) { return(true); } } return(pawn.health.hediffSet.hediffs.Any(x => part.Equals(x.Part) && x.def.spawnThingOnRemoved != null && (x is Hediff_Implant || x is Hediff_AddedPart))); }
public bool CanGetPart(Pawn pawn, BodyPartRecord part) { return(pawn.health.hediffSet.hediffs.Any(x => part.Equals(x.Part) && x.def.spawnThingOnRemoved != null && (x is Hediff_Implant || x is Hediff_AddedPart))); }