public static void SpawnThingsFromHediffs(Pawn pawn, BodyPartRecord part, IntVec3 pos, Map map) { if (!pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined).Contains(part)) { return; } IEnumerable <Hediff> enumerable = from x in pawn.health.hediffSet.hediffs where x.Part == part select x; foreach (Hediff current in enumerable) { if (current.def.spawnThingOnRemoved != null) { GenSpawn.Spawn(current.def.spawnThingOnRemoved, pos, map); } } for (int i = 0; i < part.parts.Count; i++) { CraftableLuciferium_MedicalRecipesUtility.SpawnThingsFromHediffs(pawn, part.parts[i], pos, map); } }
public static void RestorePartAndSpawnAllPreviousParts(Pawn pawn, BodyPartRecord part, IntVec3 pos, Map map) { CraftableLuciferium_MedicalRecipesUtility.SpawnNaturalPartIfClean(pawn, part, pos, map); CraftableLuciferium_MedicalRecipesUtility.SpawnThingsFromHediffs(pawn, part, pos, map); pawn.health.RestorePart(part, null, true); }