mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Don't prune pawns with sperm or a fertilized egg in a colonist's womb
This commit is contained in:
		
							parent
							
								
									5e818ab879
								
							
						
					
					
						commit
						b814412eb0
					
				
					 4 changed files with 51 additions and 2 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -178,6 +178,15 @@ namespace RJW_Menstruation
 | 
			
		|||
                return res / Props.maxCumCapacity;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public bool HasCumInside(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (cums.NullOrEmpty()) return false;
 | 
			
		||||
            foreach (Cum cum in cums)
 | 
			
		||||
            {
 | 
			
		||||
                if(cum.pawn == pawn) return true;
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        public float CumCapacity
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
| 
						 | 
				
			
			@ -419,6 +428,15 @@ namespace RJW_Menstruation
 | 
			
		|||
                return -1;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public bool IsFertilizedBy(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (eggs.NullOrEmpty()) return false;
 | 
			
		||||
            foreach (Egg egg in eggs)
 | 
			
		||||
            {
 | 
			
		||||
                if (egg.fertilizer == pawn) return true;
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        public bool IsEggExist
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
| 
						 | 
				
			
			@ -1062,8 +1080,6 @@ namespace RJW_Menstruation
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public void SetEstrus(int days)
 | 
			
		||||
        {
 | 
			
		||||
            HediffDef estrusdef = Props.concealedEstrus ? VariousDefOf.Hediff_Estrus_Concealed : VariousDefOf.Hediff_Estrus;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
using System.Collections.Generic;
 | 
			
		||||
using HarmonyLib;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using RimWorld.Planet;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Menstruation.Patch
 | 
			
		||||
{
 | 
			
		||||
    [HarmonyPatch(typeof(WorldPawnGC), "GetCriticalPawnReason")]
 | 
			
		||||
    public static class GetCriticalPawnReason_Patch
 | 
			
		||||
    {
 | 
			
		||||
        public static void Postfix(ref string __result, Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (!__result.NullOrEmpty()) return;
 | 
			
		||||
            foreach(Pawn wombHaver in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_OfPlayerFaction)
 | 
			
		||||
            {
 | 
			
		||||
                HediffComp_Menstruation comp = wombHaver.GetMenstruationComp();
 | 
			
		||||
                if (comp is null) continue;
 | 
			
		||||
                if (comp.IsFertilizedBy(pawn))
 | 
			
		||||
                {
 | 
			
		||||
                    __result = $"Fertilizing {wombHaver}'s egg";
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                if (comp.HasCumInside(pawn))
 | 
			
		||||
                {
 | 
			
		||||
                    __result = $"Cum inside {wombHaver}'s womb";
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -66,6 +66,7 @@
 | 
			
		|||
    <Compile Include="HediffComps\HediffComp_InducedOvulator.cs" />
 | 
			
		||||
    <Compile Include="HediffComps\MenstruationUtility.cs" />
 | 
			
		||||
    <Compile Include="IngestionOutcomeDoers.cs" />
 | 
			
		||||
    <Compile Include="Patch\GC_Patch.cs" />
 | 
			
		||||
    <Compile Include="Recipe_Surgery.cs" />
 | 
			
		||||
    <Compile Include="UI\Dialog_HybridCustom.cs" />
 | 
			
		||||
    <Compile Include="UI\Dialog_WombStatus.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue