mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Apply the breast/udder thing in more places, add VariousDefOf.AllBreasts
This commit is contained in:
		
							parent
							
								
									8b7b694ad3
								
							
						
					
					
						commit
						6b585afa86
					
				
					 4 changed files with 34 additions and 6 deletions
				
			
		| 
						 | 
					@ -238,6 +238,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            // A bit wasteful since Hediff_BasePregnancy.PostBirth already redid the genitals
 | 
					            // A bit wasteful since Hediff_BasePregnancy.PostBirth already redid the genitals
 | 
				
			||||||
            CopyBodyPartRecord(baby, original, Genital_Helper.get_genitalsBPR(baby), Genital_Helper.get_genitalsBPR(original));
 | 
					            CopyBodyPartRecord(baby, original, Genital_Helper.get_genitalsBPR(baby), Genital_Helper.get_genitalsBPR(original));
 | 
				
			||||||
            CopyBodyPartRecord(baby, original, Genital_Helper.get_breastsBPR(baby), Genital_Helper.get_breastsBPR(original));
 | 
					            CopyBodyPartRecord(baby, original, Genital_Helper.get_breastsBPR(baby), Genital_Helper.get_breastsBPR(original));
 | 
				
			||||||
 | 
					            CopyBodyPartRecord(baby, original, Genital_Helper.get_uddersBPR(baby), Genital_Helper.get_uddersBPR(original));
 | 
				
			||||||
            CopyBodyPartRecord(baby, original, Genital_Helper.get_anusBPR(baby), Genital_Helper.get_anusBPR(original));
 | 
					            CopyBodyPartRecord(baby, original, Genital_Helper.get_anusBPR(baby), Genital_Helper.get_anusBPR(original));
 | 
				
			||||||
            if (baby.IsHAR())
 | 
					            if (baby.IsHAR())
 | 
				
			||||||
                HARCompatibility.CopyHARPropertiesPostBirth(baby, original);
 | 
					                HARCompatibility.CopyHARPropertiesPostBirth(baby, original);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
                yield break;
 | 
					                yield break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            BodyPartRecord part = Genital_Helper.get_breastsBPR(pawn);
 | 
					            BodyPartRecord part = Genital_Helper.get_breastsBPR(pawn) ?? Genital_Helper.get_uddersBPR(pawn);
 | 
				
			||||||
            if (part != null)
 | 
					            if (part != null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,9 +97,10 @@ namespace RJW_Menstruation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static HediffComp_Breast GetBreastComp(this Pawn pawn)
 | 
					        public static HediffComp_Breast GetBreastComp(this Pawn pawn)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            List<Hediff> hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn))?.FindAll((Hediff h) => h is Hediff_PartBaseNatural || h is Hediff_PartBaseArtifical);
 | 
					            List<Hediff> hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn))?.FindAll(h => VariousDefOf.AllBreasts.Contains(h.def));
 | 
				
			||||||
            HediffComp_Breast result;
 | 
					            if (hedifflist.NullOrEmpty()) hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn))?.FindAll(h => VariousDefOf.AllBreasts.Contains(h.def));
 | 
				
			||||||
            if (hedifflist.NullOrEmpty()) return null;
 | 
					            if (hedifflist.NullOrEmpty()) return null;
 | 
				
			||||||
 | 
					            HediffComp_Breast result;
 | 
				
			||||||
            foreach (Hediff h in hedifflist)
 | 
					            foreach (Hediff h in hedifflist)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                result = h.TryGetComp<HediffComp_Breast>();
 | 
					                result = h.TryGetComp<HediffComp_Breast>();
 | 
				
			||||||
| 
						 | 
					@ -165,9 +166,9 @@ namespace RJW_Menstruation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void DrawBreastIcon(this Pawn pawn, Rect rect)
 | 
					        public static void DrawBreastIcon(this Pawn pawn, Rect rect)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("breast"));
 | 
					            Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def));
 | 
				
			||||||
            if (hediff == null)
 | 
					            if (hediff == null)
 | 
				
			||||||
                hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("breast"));
 | 
					                hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def));
 | 
				
			||||||
            Texture2D breast, nipple, areola;
 | 
					            Texture2D breast, nipple, areola;
 | 
				
			||||||
            if (hediff != null)
 | 
					            if (hediff != null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -336,7 +337,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public static string GetBreastLabel(this Pawn pawn)
 | 
					        public static string GetBreastLabel(this Pawn pawn)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("breast"));
 | 
					            Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def));
 | 
				
			||||||
 | 
					            if (hediff == null) hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def));
 | 
				
			||||||
            if (hediff != null) return hediff.LabelBase.CapitalizeFirst() + "\n(" + hediff.LabelInBrackets + ")";
 | 
					            if (hediff != null) return hediff.LabelBase.CapitalizeFirst() + "\n(" + hediff.LabelInBrackets + ")";
 | 
				
			||||||
            else return "";
 | 
					            else return "";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
 | 
					using rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation;
 | 
				
			||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
| 
						 | 
					@ -49,6 +50,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static List<ThingDef> allraces = null;
 | 
					        private static List<ThingDef> allraces = null;
 | 
				
			||||||
        private static List<PawnKindDef> allkinds = null;
 | 
					        private static List<PawnKindDef> allkinds = null;
 | 
				
			||||||
        private static HashSet<HediffDef> allvaginas = null;
 | 
					        private static HashSet<HediffDef> allvaginas = null;
 | 
				
			||||||
 | 
					        private static HashSet<HediffDef> allbreasts = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static List<ThingDef> AllRaces
 | 
					        public static List<ThingDef> AllRaces
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
| 
						 | 
					@ -95,6 +97,29 @@ namespace RJW_Menstruation
 | 
				
			||||||
                return allvaginas;
 | 
					                return allvaginas;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        public static HashSet<HediffDef> AllBreasts
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (allbreasts != null) return allbreasts;
 | 
				
			||||||
 | 
					                allbreasts = new HashSet<HediffDef>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                foreach(HediffDef hediffDef in DefDatabase<HediffDef>.AllDefsListForReading)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (hediffDef.comps.NullOrEmpty()) continue;
 | 
				
			||||||
 | 
					                    foreach(HediffCompProperties comp in hediffDef.comps)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (comp.compClass == typeof(HediffComp_Breast) || (comp.compClass?.IsSubclassOf(typeof(HediffComp_Breast)) ?? false))
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            allbreasts.Add(hediffDef);
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return allbreasts;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Defs from Milkable Colonists
 | 
					        // Defs from Milkable Colonists
 | 
				
			||||||
        public static readonly HediffDef Hediff_Lactating_Drug = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Drug");
 | 
					        public static readonly HediffDef Hediff_Lactating_Drug = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Drug");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue