예제 #1
0
        public static IEnumerable <BodyPartRecord> GetAllChildParts(BodyPartRecord part)
        {
            yield return(part);

            foreach (BodyPartRecord child in part.parts)
            {
                foreach (BodyPartRecord subChild in HarmonyPatches.GetAllChildParts(child))
                {
                    yield return(subChild);
                }
            }
            yield break;
        }
예제 #2
0
        public static bool IsChildrenClean(Pawn pawn, BodyPartRecord part)
        {
            IEnumerable <BodyPartRecord> allChildParts = HarmonyPatches.GetAllChildParts(part);

            foreach (BodyPartRecord bodyPartRecord in allChildParts)
            {
                if (!MedicalRecipesUtility.IsClean(pawn, bodyPartRecord))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #3
0
        public static bool IsChildrenDamaged(Pawn pawn, BodyPartRecord part)
        {
            IEnumerable <BodyPartRecord> allChildParts = HarmonyPatches.GetAllChildParts(part);

            //    Log.Message("Checking "+pawn+"'s "+part+"'s "+allChildParts.Count()+" children");
            foreach (BodyPartRecord bodyPartRecord in allChildParts)
            {
                //    Log.Message("Checking "+ bodyPartRecord);
                if (pawn.health.hediffSet.PartIsMissing(bodyPartRecord) || !IsClean(pawn, bodyPartRecord))
                {
                    //    Log.Message(bodyPartRecord +" is damaged!");
                    return(true);
                }
            }
            return(false);
        }