Compare commits

...

11 Commits

Author SHA1 Message Date
Akiyami Solo 2db7b8cef3 Merge branch 'dev' into 'dev'
Breast fullness is not displayed and the "milk yourself" action is not invoked on a pawn when the rjw-mc-biotech mod is present

See merge request lutepickle/rjw_menstruation!6
2024-03-13 17:55:04 +00:00
lutepickle 9a6efaf37d Have pheromones apply in caravans 2024-03-13 10:07:25 -07:00
lutepickle cca7676bc0 Have ovulation and implant chance cache be nullable 2024-03-13 08:10:50 -07:00
lutepickle ba8801370f Have TotalFertCum account for destroyed pawns and animals 2024-03-13 08:03:02 -07:00
Акиями Соло cdfe9b44b8 reduction of unnecessary inspections 2024-01-11 20:55:26 +03:00
Акиями Соло b21fc85a29 fix JobDef link for mod rjw-mc-biotech mod 2024-01-11 20:39:07 +03:00
Акиями Соло 48f020d832 fix display of breast fullness in gui for rjw-mc-biotech mod 2024-01-11 20:38:38 +03:00
lutepickle 23ae342722 Merge branch 'dev' 2024-01-08 13:55:51 -08:00
lutepickle 509eeabddc Merge branch 'dev' 2023-07-28 17:29:32 -07:00
lutepickle 6fabfd6aaf Revert "Initialize womb when displaying gizmo if needed."
This reverts commit ebbbf8ee7f.
2023-07-03 09:08:52 -07:00
lutepickle ebbbf8ee7f Initialize womb when displaying gizmo if needed. 2023-07-03 08:54:19 -07:00
6 changed files with 29 additions and 14 deletions

Binary file not shown.

View File

@ -123,8 +123,8 @@ namespace RJW_Menstruation
protected string customwombtex = null;
protected string customvagtex = null;
protected bool estrusflag = false;
protected float ovulationChanceCache = -1.0f; // Dirtied every simulation
protected float implantationChanceCache = -1.0f;
protected float? ovulationChanceCache = null; // Dirtied every simulation
protected float? implantationChanceCache = null;
protected int opcache = -1;
protected float antisperm = 0.0f;
// RJW pregnancy, or Biotech pregnancy/labor/laborpushing
@ -259,7 +259,7 @@ namespace RJW_Menstruation
}
public float TotalFertCum
{
get => cums?.Sum(cum => cum.FertVolume) ?? 0;
get => cums?.Where(cum => CumCanFertilize(cum)).Sum(cum => cum.FertVolume) ?? 0;
}
public float TotalCumPercent
{
@ -289,7 +289,7 @@ namespace RJW_Menstruation
private bool calculatingOvulationChance = false;
public bool CalculatingOvulationChance { get => calculatingOvulationChance; }
protected float CalculatedOvulationChance()
private float CalculatedOvulationChance()
{
float ovulationChance = 1.0f;
if (EggHealth <= 0.0f) return 0.0f;
@ -315,7 +315,7 @@ namespace RJW_Menstruation
return ovulationChance;
}
protected float CalculatedImplantChance()
private float CalculatedImplantChance()
{
if (ModsConfig.BiotechActive && xxx.is_human(Pawn))
{
@ -336,8 +336,8 @@ namespace RJW_Menstruation
{
get
{
if (ovulationChanceCache < 0.0f) ovulationChanceCache = CalculatedOvulationChance();
return ovulationChanceCache;
if (ovulationChanceCache == null) ovulationChanceCache = CalculatedOvulationChance();
return ovulationChanceCache.Value;
}
}
@ -346,8 +346,8 @@ namespace RJW_Menstruation
{
get
{
if (implantationChanceCache < 0.0f) implantationChanceCache = CalculatedImplantChance();
return implantationChanceCache;
if (implantationChanceCache == null) implantationChanceCache = CalculatedImplantChance();
return implantationChanceCache.Value;
}
}
@ -1266,8 +1266,8 @@ namespace RJW_Menstruation
protected virtual void BeforeSimulator()
{
ovulationChanceCache = -1.0f;
implantationChanceCache = -1.0f;
ovulationChanceCache = null;
implantationChanceCache = null;
CumOut();
}
@ -1335,10 +1335,18 @@ namespace RJW_Menstruation
}
}
public bool CumCanFertilize(Cum cum)
{
return !cum.notcum &&
cum.FertVolume > 0 &&
!(cum.pawn?.Destroyed ?? true) &&
(RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn));
}
protected Pawn Fertilize()
{
if (cums.NullOrEmpty()) return null;
List<Cum> eligibleCum = cums.FindAll(cum => !cum.notcum && cum.FertVolume > 0 && !(cum.pawn?.Destroyed ?? true) && (RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn)));
List<Cum> eligibleCum = cums.FindAll(cum => CumCanFertilize(cum));
if (eligibleCum.Count == 0) return null;
float totalFertPower = eligibleCum.Sum(cum => cum.FertVolume);

View File

@ -1,6 +1,7 @@

using RimWorld;
using RimWorld.Planet;
using rjw;
using System;
using System.Collections.Generic;
@ -46,6 +47,8 @@ namespace RJW_Menstruation
protected IEnumerable<Pawn> AffectedPawns()
{
if(Pawn.GetCaravan() is Caravan caravan)
foreach (Pawn p in caravan.PawnsListForReading.Where(p => p != Pawn)) yield return p;
Map mapHeld = Pawn.MapHeld;
if (mapHeld == null) yield break;
foreach (Pawn pawn in mapHeld.mapPawns.AllPawnsSpawned)

View File

@ -276,7 +276,10 @@ namespace RJW_Menstruation
float res = 0;
if (VariousDefOf.Hediff_Heavy_Lactating_Permanent != null)
{
if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent)) milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("hypermilkable"));
if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent)
|| pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Permanent)
|| pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Natural)
|| pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Drug)) milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("milkablehuman"));
else milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("milkable"));
}
else

View File

@ -158,7 +158,7 @@ namespace RJW_Menstruation
public static readonly HediffDef Hediff_Lactating_Natural = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Natural");
public static readonly HediffDef Hediff_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Permanent");
public static readonly HediffDef Hediff_Heavy_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Heavy_Lactating_Permanent");
public static readonly JobDef Job_LactateSelf_MC = DefDatabase<JobDef>.GetNamedSilentFail("LactateSelf_MC");
public static readonly JobDef Job_LactateSelf_MC = DefDatabase<JobDef>.GetNamedSilentFail("MilkSelf");
// Defs from Sexperience Ideology
public static readonly PreceptDef Pregnancy_Elevated = DefDatabase<PreceptDef>.GetNamedSilentFail("Pregnancy_Elevated");

View File

@ -1,5 +1,6 @@
Version 1.0.9.4
- Added graphics for the menstruation genes with thanks to Alpenglow.
- Pawns in estrus now give their pheromones to their caravan-mates.
- Pawns with the egglaying genes from Erin's Corvyia and Outland - Genetics no longer have a menstrual cycle.
Version 1.0.9.3