Compare commits

..

No commits in common. "82a34f8ea8c3499e1550b3f14ef8ae4cf6be64b3" and "3de006dbbf8896eaa63a93c39e42411364f1fed2" have entirely different histories.

13 changed files with 78 additions and 142 deletions

Binary file not shown.

View file

@ -89,7 +89,7 @@ namespace RJW_Menstruation
else m.moodPowerFactor = 0.3f;
}
if (pawn.WantsToGetPregnant()) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
if (pawn.HasQuirk(QuirkUtility.Quirks.Breeder)) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
}
}

View file

@ -69,7 +69,7 @@ namespace RJW_Menstruation
get
{
if (babyHalfAge > 0f) return babyHalfAge;
List<LifeStageAge> ages = Pawn.RaceProps.lifeStageAges;
List<LifeStageAge> ages = Pawn.def.race.lifeStageAges;
if (ages?.Count > 1)
babyHalfAge = ages[1].minAge / 2;

View file

@ -15,14 +15,6 @@ namespace RJW_Menstruation
public class HediffComp_InducedOvulator : HediffComp_Menstruation
{
protected bool hadOvulatoryStage = false; // Regardless of whether an egg was actually produced
protected override void InitializeExtraValues()
{
base.InitializeExtraValues();
hadOvulatoryStage |= IsEggExist;
}
public override string GetCurStageDesc
{
get
@ -43,7 +35,7 @@ namespace RJW_Menstruation
protected override float RaceCyclesPerYear()
{
// Don't bother with breeding season, since so much time is planned to be spent pregnant.
float pregnanciesPerYear = GenDate.DaysPerYear / Mathf.Max(1, Pawn.RaceProps.gestationPeriodDays);
float pregnanciesPerYear = GenDate.DaysPerYear / Mathf.Max(1, Pawn.def.race.gestationPeriodDays);
return 2 * pregnanciesPerYear / Configurations.ImplantationChanceDefault;
}
@ -54,31 +46,12 @@ namespace RJW_Menstruation
return Mathf.CeilToInt((Pawn.relations?.ChildrenCount ?? 0) / Configurations.ImplantationChanceDefault);
}
public override void CompExposeData()
{
base.CompExposeData();
Scribe_Values.Look(ref hadOvulatoryStage, "hadOvulatoryStage", false);
}
protected override void GoOvulatoryStage()
{
estrusflag = false;
hadOvulatoryStage = false;
GoNextStage(Stage.Luteal);
}
protected override void OvulatoryAction()
{
base.OvulatoryAction();
hadOvulatoryStage = true;
}
protected override void LutealAction()
{
base.LutealAction();
if (curStage != Stage.Luteal) hadOvulatoryStage = false;
}
protected override void AfterCumIn(Pawn cummer)
{
base.AfterCumIn(cummer);
@ -97,7 +70,7 @@ namespace RJW_Menstruation
case Stage.Ovulatory:
return true;
case Stage.Luteal:
return hadOvulatoryStage && curStageTicks < EggLifespanTicks;
return IsEggExist && curStageTicks < EggLifespanTicks;
default:
return false;
}
@ -115,7 +88,7 @@ namespace RJW_Menstruation
case Stage.Ovulatory:
return true;
case Stage.Luteal:
return hadOvulatoryStage && curStageTicks < EggLifespanTicks;
return IsEggExist && curStageTicks < EggLifespanTicks;
default:
return false;
}

View file

@ -66,7 +66,7 @@ namespace RJW_Menstruation
const float minmakefilthvalue = 1.0f;
const int maxImplantDelayHours = 30 * GenDate.HoursPerDay;
const int minImplantAgeHours = 3 * GenDate.HoursPerDay;
const float fluidLeakThreshold = 3.5f;
const float fluidLeakThreshold = 2.5f;
const float pulloutSuccessRate = 0.8f;
const float fetishPulloutSuccessModifier = 0.25f;
@ -104,7 +104,6 @@ namespace RJW_Menstruation
public static readonly Dictionary<Stage, Texture2D> StageTexture = new Dictionary<Stage, Texture2D>()
{
{ Stage.Follicular, TextureCache.FollicularTexture },
{ Stage.Ovulatory, TextureCache.OvulatoryTexture },
{ Stage.Luteal, TextureCache.LutealTexture },
{ Stage.Bleeding, TextureCache.BleedingTexture },
{ Stage.Pregnant, TextureCache.PregnantTexture },
@ -123,8 +122,6 @@ 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 int opcache = -1;
protected float antisperm = 0.0f;
protected float? originvagsize = null;
@ -198,7 +195,7 @@ namespace RJW_Menstruation
float avglittersize;
try
{
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.RaceProps.litterSizeCurve), 1.0f);
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.def.race.litterSizeCurve), 1.0f);
}
catch
{
@ -210,7 +207,7 @@ namespace RJW_Menstruation
opcache = (int)(RaceCyclesPerYear() *
avglittersize *
yearsBeforeMenopause *
(Pawn.RaceProps.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
(Pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy));
if (opcache == 0) opcache = 1;
return opcache;
}
@ -296,7 +293,9 @@ namespace RJW_Menstruation
// I hate doing this, but it's the least bad option
public bool calculatingOvulationChance = false;
protected float CalcuatedOvulationChance()
public float OvulationChance
{
get
{
float ovulationChance = 1.0f;
if (EggHealth <= 0.0f) return 0.0f;
@ -327,8 +326,10 @@ namespace RJW_Menstruation
}
return ovulationChance;
}
protected float CalcuatedImplantChance()
}
public float ImplantChance
{
get
{
float factor = 1.0f;
if (ModsConfig.BiotechActive && xxx.is_human(Pawn))
@ -345,23 +346,6 @@ namespace RJW_Menstruation
return Pawn.health.capacities.GetLevel(xxx.reproduction) * Props.baseImplantationChanceFactor * FertilityModifier * factor;
}
}
public float OvulationChance
{
get
{
if (ovulationChanceCache < 0.0f) ovulationChanceCache = CalcuatedOvulationChance();
return ovulationChanceCache;
}
}
public float ImplantChance
{
get
{
if (implantationChanceCache < 0.0f) implantationChanceCache = CalcuatedImplantChance();
return implantationChanceCache;
}
}
public IEnumerable<string> GetCumsInfo
@ -570,7 +554,7 @@ namespace RJW_Menstruation
{
try
{
Color c = Pawn.RaceProps.BloodDef.graphicData.color;
Color c = Pawn.def.race.BloodDef.graphicData.color;
return c;
}
catch
@ -1232,7 +1216,7 @@ namespace RJW_Menstruation
float avglittersize;
try
{
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.RaceProps.litterSizeCurve), 1.0f);
avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.def.race.litterSizeCurve), 1.0f);
}
catch (NullReferenceException)
{
@ -1275,8 +1259,6 @@ namespace RJW_Menstruation
protected virtual void BeforeSimulator()
{
ovulationChanceCache = -1.0f;
implantationChanceCache = -1.0f;
CumOut();
}
@ -1497,7 +1479,7 @@ namespace RJW_Menstruation
{
// ~1.5 per hour times acceleration
float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * TickInterval / GenDate.TicksPerHour;
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood);
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.def.race?.BloodDef ?? ThingDefOf.Filth_Blood);
Cum blood = GetNotCum(Translations.Menstrual_Blood);
if (blood != null) blood.Color = BloodColor;
}
@ -1619,7 +1601,7 @@ namespace RJW_Menstruation
float eggnum;
try
{
eggnum = Math.Max(Rand.ByCurve(Pawn.RaceProps.litterSizeCurve), 1f);
eggnum = Math.Max(Rand.ByCurve(Pawn.def.race.litterSizeCurve), 1f);
}
catch (NullReferenceException)
{
@ -1798,7 +1780,7 @@ namespace RJW_Menstruation
if (IsDangerDay)
{
if (Pawn.WantsToGetPregnant())
if (Pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || Pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish))
{
Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer);
}
@ -1821,7 +1803,7 @@ namespace RJW_Menstruation
}
else
{
if (Pawn.WantsToGetPregnant())
if (Pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || Pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish))
{
Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer);
}
@ -1985,7 +1967,7 @@ namespace RJW_Menstruation
public class Egg : IExposable
{
public bool fertilized;
public int lifeSpanTicks; // Actual ticks scaled by cycleAcceleration
public int lifeSpanTicks;
public Pawn fertilizer;
public int ageTicks;
public int ticksSinceFertilization = 0;
@ -2012,25 +1994,23 @@ namespace RJW_Menstruation
{
int lifespanhrs = -1;
int position = -1;
int fertstage = -1;
Scribe_Values.Look(ref lifespanhrs, "lifespanhrs", lifespanhrs, true);
Scribe_Values.Look(ref position, "position", position, true);
Scribe_Values.Look(ref fertstage, "fertstage", fertstage, true);
if (lifespanhrs >= 0) lifeSpanTicks = lifespanhrs * GenDate.TicksPerHour;
if (position >= 0) ageTicks = position * GenDate.TicksPerHour;
if (fertstage >= 0) ticksSinceFertilization = fertstage * GenDate.TicksPerHour;
}
Scribe_References.Look(ref fertilizer, "fertilizer", true);
Scribe_Values.Look(ref fertilized, "fertilized", false);
Scribe_Values.Look(ref lifeSpanTicks, "lifeSpanTicks", lifeSpanTicks, true);
Scribe_Values.Look(ref ageTicks, "ageTicks", ageTicks, true);
Scribe_Values.Look(ref ticksSinceFertilization, "ticksSinceFertilization", 0);
if (ticksSinceFertilization == 0 && Scribe.mode == LoadSaveMode.LoadingVars)
{
// A bit awkward to do this twice, but it prevents ticksSinceFertilization from getting overwritten on a fertstage load
int fertstage = -1;
Scribe_Values.Look(ref fertstage, "fertstage", fertstage, true);
if (fertstage >= 0) ticksSinceFertilization = fertstage * GenDate.TicksPerHour;
}
}
}
}
public class HediffComp_Anus : HediffComp

View file

@ -349,7 +349,7 @@ namespace RJW_Menstruation
else if (hediff is Hediff_BasePregnancy rjw_preg)
return (rjw_preg.p_end_tick - rjw_preg.p_start_tick) / GenDate.TicksPerHour;
// TODO: Biotech pregnancy
else return hediff.pawn.RaceProps.gestationPeriodDays * GenDate.HoursPerDay;
else return hediff.pawn.def.race.gestationPeriodDays * GenDate.HoursPerDay;
}
public static float RandomVariabilityPercent(int recursion = 0)
@ -401,22 +401,6 @@ namespace RJW_Menstruation
return false;
}
public static bool WantsToGetPregnant(this Pawn pawn)
{
if (pawn.HasQuirk(QuirkUtility.Quirks.Breeder) ||
pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish))
return true;
Ideo ideo = pawn.Ideo;
if (ideo == null || VariousDefOf.Pregnancy_Elevated == null) return false;
if (ideo.HasPrecept(VariousDefOf.Pregnancy_Elevated) ||
ideo.HasPrecept(VariousDefOf.Pregnancy_Holy) ||
ideo.HasPrecept(VariousDefOf.Pregnancy_Required))
return true;
return false;
}
public static float DamagePants(this Pawn pawn, float fluidAmount)
{
if (pawn.apparel == null) return 0;

View file

@ -23,11 +23,11 @@ namespace RJW_Menstruation
{
if (is_discovered ||
!xxx.is_human(pawn) ||
pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || (pawn.Ideo?.HasPrecept(VariousDefOf.Pregnancy_Required) ?? false) ||
pawn.HasQuirk(QuirkUtility.Quirks.Breeder) ||
(pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) ||
x.def.Equals(PawnRelationDefOf.Fiance))) != null)
return;
if (pawn.WantsToGetPregnant() || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
{
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
}

View file

@ -16,7 +16,7 @@ namespace RJW_Menstruation.Patch
{
if (!__result.NullOrEmpty()) return;
if (cummedPawns.Contains(pawn))
__result = "EggFertOrCumInWomb";
__result = "Has cum or fertilized egg in a womb";
}
}

View file

@ -15,13 +15,13 @@ namespace RJW_Menstruation
return milktexturecache;
}
}
// Ovulation, sex drive
public static Texture2D OvulatoryTexture
// Sex drive
public static Texture2D SexDriveTexture
{
get
{
if (ovulatorytexturecache == null) ovulatorytexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f);
return ovulatorytexturecache;
if (sexdrivetexturecache == null) sexdrivetexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f);
return sexdrivetexturecache;
}
}
// Bleeding, vulnerability
@ -93,7 +93,7 @@ namespace RJW_Menstruation
public static readonly Texture2D GatherCum_Pussy = ContentFinder<Texture2D>.Get("UI/Icon/ToPussy");
private static Texture2D milktexturecache = SolidColorMaterials.NewSolidColorTexture(0.992f, 1.0f, 0.960f, 1.0f);
private static Texture2D ovulatorytexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f);
private static Texture2D sexdrivetexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f);
private static Texture2D bleedingtexturecache = SolidColorMaterials.NewSolidColorTexture(0.415f, 0.0f, 0.003f, 1.0f);
private static Texture2D pregnanttexturecache = SolidColorMaterials.NewSolidColorTexture(0.082f, 0.453f, 0.6f, 1.0f);
private static Texture2D recovertexturecache = SolidColorMaterials.NewSolidColorTexture(0.6f, 0.83f, 0.35f, 1.0f);
@ -101,5 +101,10 @@ namespace RJW_Menstruation
private static Texture2D animaltexturecache = SolidColorMaterials.NewSolidColorTexture(0.411f, 0.521f, 0.878f, 1.0f);
private static Texture2D lutealtexturecache = SolidColorMaterials.NewSolidColorTexture(0.843f, 0.474f, 0.6f, 1.0f);
private static Texture2D whoredtexturecache = SolidColorMaterials.NewSolidColorTexture(0.7f, 0.7f, 0.0f, 1.0f);
}
}

View file

@ -433,7 +433,7 @@ namespace RJW_Menstruation
float statvalue;
const float height = 24f;
statvalue = pawn.GetStatValue(xxx.sex_drive_stat);
FillableBarLabeled(lineRect, " " + xxx.sex_drive_stat.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue / 2, TextureCache.OvulatoryTexture, Texture2D.blackTexture, xxx.sex_drive_stat.description);
FillableBarLabeled(lineRect, " " + xxx.sex_drive_stat.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue / 2, TextureCache.SexDriveTexture, Texture2D.blackTexture, xxx.sex_drive_stat.description);
lineRect.y += height;
statvalue = pawn.GetStatValue(xxx.vulnerability_stat);

View file

@ -53,7 +53,7 @@ namespace RJW_Menstruation
if (pawn.kindDef?.race == pawn.def) return pawn.kindDef;
return VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def && kind.defName.Contains("Colonist")) ??
VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def) ??
pawn.RaceProps?.AnyPawnKind ??
pawn.def.race?.AnyPawnKind ??
pawn.kindDef;
}

View file

@ -167,10 +167,5 @@ namespace RJW_Menstruation
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");
// Defs from Sexperience Ideology
public static readonly PreceptDef Pregnancy_Elevated = DefDatabase<PreceptDef>.GetNamedSilentFail("Pregnancy_Elevated");
public static readonly PreceptDef Pregnancy_Holy = DefDatabase<PreceptDef>.GetNamedSilentFail("Pregnancy_Holy");
public static readonly PreceptDef Pregnancy_Required = DefDatabase<PreceptDef>.GetNamedSilentFail("Pregnancy_Required");
}
}

View file

@ -2,7 +2,6 @@ Version 1.0.9.0
- Fix errors when opening the womb dialog of some low fertility pawns.
- Updated Traditional Chinese translation by Hydrogen.
- New options to update wombs more or less often, defaulting to every hour.
- When using the sexperience-ideology mod, pawns with pro-pregnancy precepts will have thoughts more agreeable with potential pregnancies.
- More generous egg allocation for newly spawned periodic ovulators.
- Menstruation-related genes will now stay on females during initial pawn setup.