Cut down on some indentation, remove whitespace here and there

This commit is contained in:
lutepickle 2022-07-11 08:21:42 -07:00
parent f585499871
commit 6ec27b6aba
10 changed files with 398 additions and 527 deletions

View file

@ -61,23 +61,20 @@ namespace RJW_Menstruation
{
get
{
if (DNAcache != null) return DNAcache;
try
{
DNAcache = pawn.def.GetModExtension<PawnDNAModExtension>();
}
catch (NullReferenceException)
{
DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtension>();
}
if (DNAcache == null)
{
try
{
DNAcache = pawn.def.GetModExtension<PawnDNAModExtension>();
}
catch (NullReferenceException)
{
DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtension>();
}
if (DNAcache == null)
{
DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtension>();
}
return DNAcache;
DNAcache = ThingDefOf.Human.GetModExtension<PawnDNAModExtension>();
}
else return DNAcache;
return DNAcache;
}
}
protected PawnDNAModExtension DNAcache = null;
@ -225,14 +222,13 @@ namespace RJW_Menstruation
public void CumEffects(Pawn pawn)
{
if (!notcum && DNA != null && volume >= 1.0f)
if (notcum || DNA == null || volume < 1.0f) return;
List<IngestionOutcomeDoer> doers = DNA.ingestionOutcomeDoers;
if (!doers.NullOrEmpty()) for (int i = 0; i < doers.Count; i++)
{
List<IngestionOutcomeDoer> doers = DNA.ingestionOutcomeDoers;
if (!doers.NullOrEmpty()) for (int i = 0; i < doers.Count; i++)
{
doers[i].DoIngestionOutcome(pawn, CumThing);
}
doers[i].DoIngestionOutcome(pawn, CumThing);
}
}
@ -240,8 +236,6 @@ namespace RJW_Menstruation
{
if (volume < 0.01f) volume = 0f;
}
}
public class CumMixture : Cum, IDisposable
@ -282,16 +276,11 @@ namespace RJW_Menstruation
{
string res = "";
if (!cums.NullOrEmpty()) for(int i=0; i<cums.Count; i++)
{
res += cums[i];
if (i < cums.Count - 1) res += ", ";
}
{
res += cums[i];
if (i < cums.Count - 1) res += ", ";
}
return res;
}
}
}

View file

@ -88,27 +88,21 @@ namespace RJW_Menstruation
{
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{
List<Thought_Memory> memories = pawn.needs?.mood?.thoughts?.memories?.Memories.FindAll(
x =>
x =>
x.def == VariousDefOf.CameInsideF
|| x.def == VariousDefOf.CameInsideFFetish
|| x.def == VariousDefOf.HaterCameInsideF);
if (!memories.NullOrEmpty())
if (memories.NullOrEmpty()) return;
foreach (Thought_Memory m in memories)
{
foreach (Thought_Memory m in memories)
{
if (m.def == VariousDefOf.HaterCameInsideF) m.moodPowerFactor = 0.5f;
else m.moodPowerFactor = 0.3f;
}
if (pawn.Has(Quirk.Breeder)) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
if (m.def == VariousDefOf.HaterCameInsideF) m.moodPowerFactor = 0.5f;
else m.moodPowerFactor = 0.3f;
}
if (pawn.Has(Quirk.Breeder)) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
}
}
}

View file

@ -201,12 +201,12 @@ namespace RJW_Menstruation
{
get
{
if (!cums.NullOrEmpty()) foreach (Cum cum in cums)
{
if (!cum.notcum) yield return String.Format(cum.pawn?.Label + ": {0:0.##}ml", cum.Volume);
else yield return String.Format(cum.notcumLabel + ": {0:0.##}ml", cum.Volume);
}
else yield return Translations.Info_noCum;
if (cums.NullOrEmpty()) yield return Translations.Info_noCum;
else foreach (Cum cum in cums)
{
if (!cum.notcum) yield return String.Format(cum.pawn?.Label + ": {0:0.##}ml", cum.Volume);
else yield return String.Format(cum.notcumLabel + ": {0:0.##}ml", cum.Volume);
}
}
}
public Color GetCumMixtureColor
@ -215,16 +215,15 @@ namespace RJW_Menstruation
{
Color mixedcolor = Color.white;
if (!cums.NullOrEmpty())
if (cums.NullOrEmpty()) return mixedcolor;
float mixedsofar = 0;
foreach (Cum cum in cums)
{
float mixedsofar = 0;
foreach (Cum cum in cums)
if (cum.Volume > 0)
{
if (cum.Volume > 0)
{
mixedcolor = Colors.CMYKLerp(mixedcolor, cum.Color, cum.Volume / (mixedsofar + cum.Volume));
mixedsofar += cum.Volume;
}
mixedcolor = Colors.CMYKLerp(mixedcolor, cum.Color, cum.Volume / (mixedsofar + cum.Volume));
mixedsofar += cum.Volume;
}
}
return mixedcolor;
@ -344,24 +343,23 @@ namespace RJW_Menstruation
{
get
{
if (eggs.NullOrEmpty()) return "";
string res = "";
if (!eggs.NullOrEmpty())
int fertilized = 0;
foreach (Egg egg in eggs)
{
int fertilized = 0;
foreach (Egg egg in eggs)
{
if (egg.fertilized) fertilized++;
}
if (fertilized != 0) res += fertilized + " " + Translations.Dialog_WombInfo05;
if (fertilized != 0 && eggs.Count - fertilized != 0) res += ", ";
if (cums.NullOrEmpty() || TotalFertCum == 0)
{
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo07;
}
else
{
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo06;
}
if (egg.fertilized) fertilized++;
}
if (fertilized != 0) res += fertilized + " " + Translations.Dialog_WombInfo05;
if (fertilized != 0 && eggs.Count - fertilized != 0) res += ", ";
if (cums.NullOrEmpty() || TotalFertCum == 0)
{
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo07;
}
else
{
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo06;
}
return res;
}
@ -370,16 +368,12 @@ namespace RJW_Menstruation
{
get
{
if (!eggs.NullOrEmpty())
if (eggs.NullOrEmpty() || cums.NullOrEmpty()) return false;
foreach (Cum cum in cums)
{
if (!cums.NullOrEmpty()) foreach (Cum cum in cums)
{
if (cum.FertVolume > 0) return true;
}
return false;
if (cum.FertVolume > 0) return true;
}
else return false;
return false;
}
}
/// <summary>
@ -867,15 +861,13 @@ namespace RJW_Menstruation
/// <returns></returns>
protected void FertilizationCheck()
{
if (!eggs.NullOrEmpty())
if (eggs.NullOrEmpty()) return;
foreach (Egg egg in eggs)
{
foreach (Egg egg in eggs)
if (!egg.fertilized) egg.fertilizer = Fertilize();
if (egg.fertilizer != null)
{
if (!egg.fertilized) egg.fertilizer = Fertilize();
if (egg.fertilizer != null)
{
egg.fertilized = true;
}
egg.fertilized = true;
}
}
}
@ -884,61 +876,61 @@ namespace RJW_Menstruation
{
Props = (CompProperties_Menstruation)props;
if (!Props.infertile)
{
if (cycleSpeed < 0f) cycleSpeed = Utility.RandGaussianLike(0.8f, 1.2f);
if (cycleVariability < 0f) cycleVariability = MenstruationUtility.RandomVariabilityPercent();
if (currentIntervalHours < 0)
{
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young;
else if (!IsBreedingSeason()) curStage = Stage.Anestrus;
else curStage = RandomStage();
if (curStage == Stage.Follicular)
currentIntervalHours = PeriodRandomizer(Stage.Follicular) - PeriodRandomizer(Stage.Bleeding);
else
currentIntervalHours = PeriodRandomizer(curStage);
if (currentIntervalHours <= 0) currentIntervalHours = 1;
else if (currentIntervalHours < curStageHrs) curStageHrs = currentIntervalHours;
}
if (crampPain < 0) crampPain = PainRandomizer();
if (cums == null) cums = new List<Cum>();
if (eggs == null) eggs = new List<Egg>();
InitOvary();
Hediff_BasePregnancy pregnancy = parent.pawn.GetRJWPregnancy();
if (pregnancy != null)
{
Hediff hediff = PregnancyHelper.GetPregnancy(parent.pawn);
if (hediff != null)
{
if (hediff is Hediff_BasePregnancy preg)
{
currentIntervalHours = (int)(preg.GestationHours());
curStage = Stage.Pregnant;
}
}
}
if (parent.pawn.IsAnimal())
{
if (Configurations.EnableAnimalCycle)
{
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
}
}
else
{
if (pregnancy == null && parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Young), GetNextUpdate(), parent.pawn, false);
else HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
}
}
else
if (Props.infertile)
{
if (cums == null) cums = new List<Cum>();
curStage = Stage.None;
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
loaded = true;
return;
}
if (cycleSpeed < 0f) cycleSpeed = Utility.RandGaussianLike(0.8f, 1.2f);
if (cycleVariability < 0f) cycleVariability = MenstruationUtility.RandomVariabilityPercent();
if (currentIntervalHours < 0)
{
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young;
else if (!IsBreedingSeason()) curStage = Stage.Anestrus;
else curStage = RandomStage();
if (curStage == Stage.Follicular)
currentIntervalHours = PeriodRandomizer(Stage.Follicular) - PeriodRandomizer(Stage.Bleeding);
else
currentIntervalHours = PeriodRandomizer(curStage);
if (currentIntervalHours <= 0) currentIntervalHours = 1;
else if (currentIntervalHours < curStageHrs) curStageHrs = currentIntervalHours;
}
if (crampPain < 0) crampPain = PainRandomizer();
if (cums == null) cums = new List<Cum>();
if (eggs == null) eggs = new List<Egg>();
InitOvary();
Hediff_BasePregnancy pregnancy = parent.pawn.GetRJWPregnancy();
if (pregnancy != null)
{
Hediff hediff = PregnancyHelper.GetPregnancy(parent.pawn);
if (hediff != null)
{
if (hediff is Hediff_BasePregnancy preg)
{
currentIntervalHours = (int)(preg.GestationHours());
curStage = Stage.Pregnant;
}
}
}
if (parent.pawn.IsAnimal())
{
if (Configurations.EnableAnimalCycle)
{
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
}
}
else
{
if (pregnancy == null && parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(Stage.Young), GetNextUpdate(), parent.pawn, false);
else HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
}
//Log.Message(parent.pawn.Label + " - Initialized menstruation comp");
loaded = true;
@ -1120,85 +1112,83 @@ namespace RJW_Menstruation
protected bool Implant()
{
if (!eggs.NullOrEmpty())
if (eggs.NullOrEmpty()) return false;
List<Egg> deadeggs = new List<Egg>();
bool pregnant = false;
foreach (Egg egg in eggs)
{
List<Egg> deadeggs = new List<Egg>();
bool pregnant = false;
foreach (Egg egg in eggs)
if (!egg.fertilized ||
egg.fertstage < minImplantAgeHours ||
egg.position < Math.Min(Props.lutealIntervalDays / 2, maxImplantDelayDays) * 24)
continue;
else if (egg.fertilizer == null)
{
if (!egg.fertilized ||
egg.fertstage < minImplantAgeHours ||
egg.position < Math.Min(Props.lutealIntervalDays / 2, maxImplantDelayDays) * 24)
continue;
else if (egg.fertilizer == null)
deadeggs.Add(egg);
continue;
}
else if (Rand.Range(0.0f, 1.0f) <= Configurations.ImplantationChance * ImplantFactor * InterspeciesImplantFactor(egg.fertilizer))
{
Hediff_BasePregnancy pregnancy = parent.pawn.GetRJWPregnancy();
if (pregnancy != null)
{
deadeggs.Add(egg);
continue;
}
else if (Rand.Range(0.0f, 1.0f) <= Configurations.ImplantationChance * ImplantFactor * InterspeciesImplantFactor(egg.fertilizer))
{
Hediff_BasePregnancy pregnancy = parent.pawn.GetRJWPregnancy();
if (pregnancy != null)
if (Configurations.UseMultiplePregnancy && Configurations.EnableHeteroOvularTwins)
{
if (Configurations.UseMultiplePregnancy && Configurations.EnableHeteroOvularTwins)
if (pregnancy is Hediff_MultiplePregnancy h)
{
if (pregnancy is Hediff_MultiplePregnancy h)
{
h.AddNewBaby(parent.pawn, egg.fertilizer);
}
pregnant = true;
deadeggs.Add(egg);
h.AddNewBaby(parent.pawn, egg.fertilizer);
}
else
{
pregnant = true;
break;
}
pregnant = true;
deadeggs.Add(egg);
}
else
{
if (!Configurations.UseMultiplePregnancy)
{
PregnancyHelper.PregnancyDecider(parent.pawn, egg.fertilizer);
Hediff_BasePregnancy hediff = (Hediff_BasePregnancy)PregnancyHelper.GetPregnancy(parent.pawn);
currentIntervalHours = (int)hediff?.GestationHours();
pregnant = true;
break;
}
else
{
Hediff_BasePregnancy.Create<Hediff_MultiplePregnancy>(parent.pawn, egg.fertilizer);
Hediff_BasePregnancy hediff = (Hediff_BasePregnancy)PregnancyHelper.GetPregnancy(parent.pawn);
currentIntervalHours = (int)hediff?.GestationHours();
pregnant = true;
deadeggs.Add(egg);
}
pregnant = true;
break;
}
}
else deadeggs.Add(egg);
}
if (pregnant && (!Configurations.UseMultiplePregnancy || !Configurations.EnableHeteroOvularTwins))
{
eggs.Clear();
deadeggs.Clear();
return true;
}
else if (!deadeggs.NullOrEmpty())
{
foreach (Egg egg in deadeggs)
{
eggs.Remove(egg);
}
deadeggs.Clear();
else
{
if (!Configurations.UseMultiplePregnancy)
{
PregnancyHelper.PregnancyDecider(parent.pawn, egg.fertilizer);
Hediff_BasePregnancy hediff = (Hediff_BasePregnancy)PregnancyHelper.GetPregnancy(parent.pawn);
currentIntervalHours = (int)hediff?.GestationHours();
pregnant = true;
break;
}
else
{
Hediff_BasePregnancy.Create<Hediff_MultiplePregnancy>(parent.pawn, egg.fertilizer);
Hediff_BasePregnancy hediff = (Hediff_BasePregnancy)PregnancyHelper.GetPregnancy(parent.pawn);
currentIntervalHours = (int)hediff?.GestationHours();
pregnant = true;
deadeggs.Add(egg);
}
}
}
if (pregnant) return true;
else deadeggs.Add(egg);
}
return false;
if (pregnant && (!Configurations.UseMultiplePregnancy || !Configurations.EnableHeteroOvularTwins))
{
eggs.Clear();
deadeggs.Clear();
return true;
}
else if (!deadeggs.NullOrEmpty())
{
foreach (Egg egg in deadeggs)
{
eggs.Remove(egg);
}
deadeggs.Clear();
}
return pregnant;
}
protected void BleedOut()
@ -1229,32 +1219,26 @@ namespace RJW_Menstruation
protected float AbsorbCum(float amount, Absorber absorber)
{
if (absorber != null)
{
float absorbable = absorber.GetStatValue(VariousDefOf.MaxAbsorbable);
absorber.SetColor(Colors.CMYKLerp(GetCumMixtureColor, absorber.DrawColor, 1f - amount / absorbable));
if (!absorber.dirty)
{
absorber.absorbedfluids += amount;
if (absorber.absorbedfluids > absorbable && !parent.pawn.apparel.IsLocked(absorber))
{
absorber.def = absorber.DirtyDef;
//absorber.fluidColor = GetCumMixtureColor;
absorber.dirty = true;
}
}
else
{
//if (absorber.LeakAfterDirty) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort);
return amount;
}
}
else
if (absorber == null)
{
//if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort);
return amount;
}
float absorbable = absorber.GetStatValue(VariousDefOf.MaxAbsorbable);
absorber.SetColor(Colors.CMYKLerp(GetCumMixtureColor, absorber.DrawColor, 1f - amount / absorbable));
if (absorber.dirty)
{
//if (absorber.LeakAfterDirty) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort);
return amount;
}
absorber.absorbedfluids += amount;
if (absorber.absorbedfluids > absorbable && !parent.pawn.apparel.IsLocked(absorber))
{
absorber.def = absorber.DirtyDef;
//absorber.fluidColor = GetCumMixtureColor;
absorber.dirty = true;
}
return 0;
}
@ -1545,55 +1529,54 @@ namespace RJW_Menstruation
protected virtual void ThoughtCumInside(Pawn cummer)
{
if (xxx.is_human(parent.pawn) && xxx.is_human(cummer))
{
if ((cummer.Has(Quirk.Teratophile) != (parent.pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) ||
cummer.Has(Quirk.ImpregnationFetish) ||
cummer.Has(Quirk.Breeder))
{
if (cummer.relations.OpinionOf(parent.pawn) <= -25)
{
cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideM, parent.pawn);
}
else
{
cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideM, parent.pawn);
}
}
if (!xxx.is_human(parent.pawn) || !xxx.is_human(cummer)) return;
if (IsDangerDay)
if ((cummer.Has(Quirk.Teratophile) != (parent.pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) ||
cummer.Has(Quirk.ImpregnationFetish) ||
cummer.Has(Quirk.Breeder))
{
if (cummer.relations.OpinionOf(parent.pawn) <= -25)
{
if (parent.pawn.Has(Quirk.Breeder) || parent.pawn.Has(Quirk.ImpregnationFetish))
{
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer);
}
else if (parent.pawn.relations.OpinionOf(cummer) <= -5)
{
parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer);
parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.HaterCameInsideFEstrus, cummer);
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideF, cummer);
}
else if (parent.pawn.IsInEstrus() && parent.pawn.relations.OpinionOf(cummer) < RJWHookupSettings.MinimumRelationshipToHookup)
{
parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer);
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFEstrus, cummer);
}
else if (!parent.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, cummer) && !parent.pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, cummer))
{
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) < 0.50f) parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFLowFert, cummer);
else parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideF, cummer);
}
cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideM, parent.pawn);
}
else
{
if (parent.pawn.Has(Quirk.Breeder) || parent.pawn.Has(Quirk.ImpregnationFetish))
{
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer);
}
else if (parent.pawn.relations.OpinionOf(cummer) <= -5)
{
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFSafe, cummer);
}
cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideM, parent.pawn);
}
}
if (IsDangerDay)
{
if (parent.pawn.Has(Quirk.Breeder) || parent.pawn.Has(Quirk.ImpregnationFetish))
{
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer);
}
else if (parent.pawn.relations.OpinionOf(cummer) <= -5)
{
parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer);
parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.HaterCameInsideFEstrus, cummer);
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideF, cummer);
}
else if (parent.pawn.IsInEstrus() && parent.pawn.relations.OpinionOf(cummer) < RJWHookupSettings.MinimumRelationshipToHookup)
{
parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer);
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFEstrus, cummer);
}
else if (!parent.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, cummer) && !parent.pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, cummer))
{
if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) < 0.50f) parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFLowFert, cummer);
else parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideF, cummer);
}
}
else
{
if (parent.pawn.Has(Quirk.Breeder) || parent.pawn.Has(Quirk.ImpregnationFetish))
{
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer);
}
else if (parent.pawn.relations.OpinionOf(cummer) <= -5)
{
parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFSafe, cummer);
}
}
}
@ -1800,14 +1783,8 @@ namespace RJW_Menstruation
return Stage.Bleeding;
default: return Stage.Follicular;
}
}
public class Egg : IExposable
{
public bool fertilized;
@ -1871,12 +1848,4 @@ namespace RJW_Menstruation
{
}
}
}

View file

@ -238,36 +238,31 @@ namespace RJW_Menstruation
public static Texture2D GetAnalIcon(this Pawn pawn, bool drawOrigin = false)
{
var hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("anus"));
if (hediff != null)
if (hediff == null) return ContentFinder<Texture2D>.Get(("Genitals/Anal00"), true);
string icon;
float severity;
HediffComp_Anus comp = hediff.GetAnusComp();
if (comp != null)
{
string icon;
float severity;
HediffComp_Anus comp = hediff.GetAnusComp();
if (comp != null)
{
CompProperties_Anus Props = (CompProperties_Anus)comp.props;
icon = Props.analTex ?? "Genitals/Anal";
if (drawOrigin) severity = comp.OriginAnusSize;
else severity = hediff.Severity;
}
else
{
icon = "Genitals/Anal";
severity = hediff.Severity;
}
if (severity < 0.20f) icon += "00"; //micro
else if (severity < 0.40f) icon += "01"; //tight
else if (severity < 0.60f) icon += "02"; //average
else if (severity < 0.80f) icon += "03"; //accomodating
else if (severity < 1.01f) icon += "04"; //cavernous
else icon += "05"; //abyssal
return ContentFinder<Texture2D>.Get((icon), true);
CompProperties_Anus Props = (CompProperties_Anus)comp.props;
icon = Props.analTex ?? "Genitals/Anal";
if (drawOrigin) severity = comp.OriginAnusSize;
else severity = hediff.Severity;
}
else
{
return ContentFinder<Texture2D>.Get(("Genitals/Anal00"), true);
icon = "Genitals/Anal";
severity = hediff.Severity;
}
if (severity < 0.20f) icon += "00"; //micro
else if (severity < 0.40f) icon += "01"; //tight
else if (severity < 0.60f) icon += "02"; //average
else if (severity < 0.80f) icon += "03"; //accomodating
else if (severity < 1.01f) icon += "04"; //cavernous
else icon += "05"; //abyssal
return ContentFinder<Texture2D>.Get((icon), true);
}
public static float GestationHours(this Hediff_BasePregnancy hediff)

View file

@ -17,20 +17,19 @@ namespace RJW_Menstruation
protected void PregnancyThought()
{
if (!is_discovered && xxx.is_human(pawn))
if (is_discovered ||
!xxx.is_human(pawn) ||
pawn.Has(Quirk.Breeder) ||
(pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) ||
x.def.Equals(PawnRelationDefOf.Fiance))) != null)
return;
if (pawn.Has(Quirk.ImpregnationFetish) || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
{
if (!pawn.Has(Quirk.Breeder) && pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) || x.def.Equals(PawnRelationDefOf.Fiance)) == null)
{
if (pawn.Has(Quirk.ImpregnationFetish) || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
{
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
}
else
{
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancy);
}
}
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
}
else
{
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancy);
}
}
@ -67,22 +66,22 @@ namespace RJW_Menstruation
public string GetBabyInfo()
{
if (babies.NullOrEmpty())
return "Null";
string res = "";
if (!babies.NullOrEmpty())
var babiesdistinct = babies.Distinct(new RaceComparer());
int iteration = 0;
foreach (Pawn baby in babiesdistinct)
{
var babiesdistinct = babies.Distinct(new RaceComparer());
int iteration = 0;
foreach (Pawn baby in babiesdistinct)
{
int num = babies.Where(x => x.def.Equals(baby.def)).Count();
if (iteration > 0) res += ", ";
res += num + " " + baby.def.label;
iteration++;
}
res += " " + Translations.Dialog_WombInfo02;
return res;
int num = babies.Where(x => x.def.Equals(baby.def)).Count();
if (iteration > 0) res += ", ";
res += num + " " + baby.def.label;
iteration++;
}
return "Null";
res += " " + Translations.Dialog_WombInfo02;
return res;
}
public string GetFatherInfo()
@ -295,16 +294,15 @@ namespace RJW_Menstruation
protected void Train(Pawn baby, Pawn mother)
{
if (!xxx.is_human(baby) && baby.Faction == Faction.OfPlayer)
if (xxx.is_human(baby) || baby.Faction != Faction.OfPlayer) return;
if (xxx.is_human(mother) && baby.Faction == Faction.OfPlayer && baby.training.CanAssignToTrain(TrainableDefOf.Obedience, out _).Accepted)
{
if (xxx.is_human(mother) && baby.Faction == Faction.OfPlayer && baby.training.CanAssignToTrain(TrainableDefOf.Obedience, out _).Accepted)
{
baby.training.Train(TrainableDefOf.Obedience, mother);
}
if (xxx.is_human(mother) && baby.Faction == Faction.OfPlayer && baby.training.CanAssignToTrain(TrainableDefOf.Tameness, out _).Accepted)
{
baby.training.Train(TrainableDefOf.Tameness, mother);
}
baby.training.Train(TrainableDefOf.Obedience, mother);
}
if (xxx.is_human(mother) && baby.Faction == Faction.OfPlayer && baby.training.CanAssignToTrain(TrainableDefOf.Tameness, out _).Accepted)
{
baby.training.Train(TrainableDefOf.Tameness, mother);
}
}
@ -421,30 +419,28 @@ namespace RJW_Menstruation
public Pawn GenerateBaby(PawnGenerationRequest request, Pawn mother, Pawn father, List<Trait> parentTraits, int traitSeed)
{
Pawn baby = PawnGenerator.GeneratePawn(request);
if (baby != null)
if (baby == null)
{
if (xxx.is_human(baby) || (baby.relations != null && !RJWSettings.Disable_bestiality_pregnancy_relations))
Log.Error("Baby not generated. Request: " + request.ToString());
return null;
}
if (xxx.is_human(baby) || (baby.relations != null && !RJWSettings.Disable_bestiality_pregnancy_relations))
{
baby.SetMother(mother);
if (mother != father)
{
baby.SetMother(mother);
if (mother != father)
{
if (father.gender != Gender.Female) baby.SetFather(father);
else
{
baby.relations.AddDirectRelation(PawnRelationDefOf.Parent, father);
}
}
}
if (xxx.is_human(baby))
{
// Ensure the same inherited traits are chosen each run
// Has to happen right here so GeneratePawn up there still gets unique results
Rand.PushState(traitSeed); // With a seed just to make sure that fraternal twins *don't* get trait-duped
UpdateTraits(baby, parentTraits);
Rand.PopState();
if (father.gender != Gender.Female) baby.SetFather(father);
else baby.relations.AddDirectRelation(PawnRelationDefOf.Parent, father);
}
}
else Log.Error("Baby not generated. Request: " + request.ToString());
if (xxx.is_human(baby))
{
// Ensure the same inherited traits are chosen each run
// Has to happen right here so GeneratePawn up there still gets unique results
Rand.PushState(traitSeed); // With a seed just to make sure that fraternal twins *don't* get trait-duped
UpdateTraits(baby, parentTraits);
Rand.PopState();
}
return baby;
}
@ -568,9 +564,6 @@ namespace RJW_Menstruation
if (!spawn_kind_def_list.NullOrEmpty()) spawn_kind_def = spawn_kind_def_list.RandomElement();
}
return spawn_kind_def;
}

View file

@ -86,18 +86,18 @@ namespace RJW_Menstruation
{
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = partner.GetMenstruationComp();
if (comp != null)
if (comp == null)
{
if (AndroidsCompatibility.IsAndroid(pawn) && !AndroidsCompatibility.AndroidPenisFertility(pawn))
{
comp.CumIn(pawn, pawn.GetCumVolume(), 0);
return false;
}
else comp.CumIn(pawn, pawn.GetCumVolume(), pawn.health.capacities.GetLevel(xxx.reproduction));
ModLog.Message("used original rjw method: Comp missing");
return true;
}
else if (AndroidsCompatibility.IsAndroid(pawn) && !AndroidsCompatibility.AndroidPenisFertility(pawn))
{
comp.CumIn(pawn, pawn.GetCumVolume(), 0);
return false;
}
ModLog.Message("used original rjw method: Comp missing");
return true;
else comp.CumIn(pawn, pawn.GetCumVolume(), pawn.health.capacities.GetLevel(xxx.reproduction));
return false;
}
}

View file

@ -20,10 +20,7 @@ namespace RJW_Menstruation
public HybridExtension GetHybridExtension(string race)
{
if (hybridExtension.NullOrEmpty()) return null;
else
{
return hybridExtension.Find(x => x.thingDef.defName.Equals(race));
}
else return hybridExtension.Find(x => x.thingDef.defName.Equals(race));
}
public PawnKindDef GetHybridWith(string race)
@ -69,19 +66,13 @@ namespace RJW_Menstruation
XmlNodeList childNodes = xmlRoot.ChildNodes;
if (childNodes.Count >= 1) foreach (XmlNode node in childNodes)
{
#if DEBUG
Log.Message(xmlRoot.Name + "HybridInfo: " + node.Name + " " + node.InnerText);
#endif
hybridInfo.Add(node.Name, ParseHelper.FromString<float>(node.InnerText));
}
{
#if DEBUG
Log.Message(xmlRoot.Name + "HybridInfo: " + node.Name + " " + node.InnerText);
#endif
hybridInfo.Add(node.Name, ParseHelper.FromString<float>(node.InnerText));
}
}
}
public class HybridInformations : IExposable
@ -145,9 +136,6 @@ namespace RJW_Menstruation
Scribe_Values.Look(ref thingDefName, "thingDefName");
Scribe_Collections.Look(ref hybridExtension, "hybridExtension", LookMode.Deep, new object[0]);
}
}
public class HybridExtensionExposable : HybridExtension, IExposable
@ -197,10 +185,6 @@ namespace RJW_Menstruation
}
}
public class AbsorberModExtension : DefModExtension
{
public bool leakAfterDirty = false;
@ -222,8 +206,6 @@ namespace RJW_Menstruation
public Color fluidColor = Color.white;
public virtual void DirtyEffect() { }
public virtual void WearEffect()
@ -299,13 +281,5 @@ namespace RJW_Menstruation
color = value;
}
}
}
}

View file

@ -29,14 +29,8 @@ namespace RJW_Menstruation
if (!VariousDefOf.AllRaces.NullOrEmpty())
foreach(ThingDef def in VariousDefOf.AllRaces)
{
if (def.race != null)
{
if (Configurations.IsOverrideExist(def)) continue;
else
{
raceList.Add(new FloatMenuOption(def.label, delegate { AddHybridOverride(def);}, def.uiIcon, Color.white ));
}
}
if (def.race == null || Configurations.IsOverrideExist(def)) continue;
raceList.Add(new FloatMenuOption(def.label, delegate { AddHybridOverride(def); }, def.uiIcon, Color.white));
}
raceList.SortBy(x => x.Label);
}
@ -44,17 +38,15 @@ namespace RJW_Menstruation
public void AddHybridOverride(ThingDef def)
{
FloatMenuOption option = raceList.FirstOrDefault(x => x.Label.Equals(def?.label));
if (option != null)
if (option == null) return;
raceList.Remove(option);
if (Configurations.HybridOverride.NullOrEmpty())
{
raceList.Remove(option);
if (Configurations.HybridOverride.NullOrEmpty())
{
Configurations.HybridOverride = new List<HybridInformations>();
}
Configurations.HybridOverride.Add(new HybridInformations(def));
Configurations.HybridOverride.SortBy(x => x.GetDef?.label ?? "Undefined");
Configurations.HybridOverride = new List<HybridInformations>();
}
Configurations.HybridOverride.Add(new HybridInformations(def));
Configurations.HybridOverride.SortBy(x => x.GetDef?.label ?? "Undefined");
}
public override Vector2 InitialSize
@ -279,18 +271,19 @@ namespace RJW_Menstruation
protected void BuildRaceList()
{
raceList.Clear();
if (!VariousDefOf.AllRaces.NullOrEmpty())
foreach (ThingDef def in VariousDefOf.AllRaces)
if (VariousDefOf.AllRaces.NullOrEmpty()) return;
foreach (ThingDef def in VariousDefOf.AllRaces)
{
if (def.race != null)
{
if (def.race != null)
if (info.hybridExtension.Exists(x => x.DefName == def.defName)) continue;
else
{
if (info.hybridExtension.Exists(x => x.DefName == def.defName)) continue;
else
{
raceList.Add(new FloatMenuOption(def.label, delegate { AddHybridInfo(def); }, Widgets.GetIconFor(def), Color.white));
}
raceList.Add(new FloatMenuOption(def.label, delegate { AddHybridInfo(def); }, Widgets.GetIconFor(def), Color.white));
}
}
}
raceList.SortBy(x => x.Label);
}

View file

@ -97,13 +97,10 @@ namespace RJW_Menstruation
var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn))?.FindAll((Hediff h) => h is Hediff_PartBaseNatural || h is Hediff_PartBaseArtifical);
HediffComp_Breast result;
if (hedifflist.NullOrEmpty()) return null;
else
foreach(Hediff h in hedifflist)
{
foreach(Hediff h in hedifflist)
{
result = h.TryGetComp<HediffComp_Breast>();
if (result != null) return result;
}
result = h.TryGetComp<HediffComp_Breast>();
if (result != null) return result;
}
return null;
}
@ -128,24 +125,19 @@ namespace RJW_Menstruation
var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
HediffComp_Menstruation result;
if (hedifflist.NullOrEmpty()) return false;
else
foreach (Hediff h in hedifflist)
{
foreach (Hediff h in hedifflist)
{
result = h.TryGetComp<HediffComp_Menstruation>();
if (result != null) return true;
}
result = h.TryGetComp<HediffComp_Menstruation>();
if (result != null) return true;
}
return false;
}
public static bool HasMenstruationComp(this Hediff hediff)
{
if (hediff is Hediff_PartBaseNatural || hediff is Hediff_PartBaseArtifical)
{
if (hediff.TryGetComp<HediffComp_Menstruation>() != null) return true;
}
return false;
if ((hediff is Hediff_PartBaseNatural || hediff is Hediff_PartBaseArtifical) && hediff.TryGetComp<HediffComp_Menstruation>() != null)
return true;
else return false;
}
@ -299,29 +291,27 @@ namespace RJW_Menstruation
milkcomp = pawn.GetComp<CompMilkable>();
}
if (milkcomp != null)
if (milkcomp == null) return;
if (milkcomp is CompMilkable milkable)
{
if (milkcomp is CompMilkable milkable)
bool active = (bool)milkcomp.GetPropertyValue("Active");
if (active)
{
bool active = (bool)milkcomp.GetPropertyValue("Active");
if (active)
{
CompMilkable m = milkable;
res = Math.Max(m.Fullness, res);
Widgets.FillableBar(rect, Math.Min(res, 1.0f), TextureCache.MilkTexture, Texture2D.blackTexture, true);
DrawMilkBottle(rect, pawn, VariousDefOf.Job_LactateSelf, m.Fullness);
}
CompMilkable m = milkable;
res = Math.Max(m.Fullness, res);
Widgets.FillableBar(rect, Math.Min(res, 1.0f), TextureCache.MilkTexture, Texture2D.blackTexture, true);
DrawMilkBottle(rect, pawn, VariousDefOf.Job_LactateSelf, m.Fullness);
}
else
}
else
{
bool active = (bool)milkcomp.GetPropertyValue("Active");
if (active)
{
bool active = (bool)milkcomp.GetPropertyValue("Active");
if (active)
{
float fullness = (float)milkcomp.GetMemberValue("fullness");
res = Math.Max(fullness, res);
Widgets.FillableBar(rect, Math.Min(res, 1.0f), TextureCache.MilkTexture, Texture2D.blackTexture, true);
DrawMilkBottle(rect, pawn, VariousDefOf.Job_LactateSelf_MC, fullness);
}
float fullness = (float)milkcomp.GetMemberValue("fullness");
res = Math.Max(fullness, res);
Widgets.FillableBar(rect, Math.Min(res, 1.0f), TextureCache.MilkTexture, Texture2D.blackTexture, true);
DrawMilkBottle(rect, pawn, VariousDefOf.Job_LactateSelf_MC, fullness);
}
}
}
@ -330,30 +320,29 @@ namespace RJW_Menstruation
{
Texture2D texture;
Rect buttonrect = new Rect(rect.x, rect.y, rect.height, rect.height);
if (fullness > 0.0f)
{
if (fullness < 0.3f) texture = ContentFinder<Texture2D>.Get("Milk/Milkbottle_Small", false);
else if (fullness < 0.7f) texture = ContentFinder<Texture2D>.Get("Milk/Milkbottle_Medium", false);
else texture = ContentFinder<Texture2D>.Get("Milk/Milkbottle_Large", false);
GUIContent icon = new GUIContent(texture);
GUIStyle style = GUIStyle.none;
style.normal.background = texture;
string tooltip = Translations.Button_MilkTooltip;
if (fullness <= 0.0f) return;
if (fullness < 0.3f) texture = ContentFinder<Texture2D>.Get("Milk/Milkbottle_Small", false);
else if (fullness < 0.7f) texture = ContentFinder<Texture2D>.Get("Milk/Milkbottle_Medium", false);
else texture = ContentFinder<Texture2D>.Get("Milk/Milkbottle_Large", false);
GUIContent icon = new GUIContent(texture);
GUIStyle style = GUIStyle.none;
style.normal.background = texture;
string tooltip = Translations.Button_MilkTooltip;
TooltipHandler.TipRegion(buttonrect, tooltip);
if (GUI.Button(buttonrect, icon, style))
TooltipHandler.TipRegion(buttonrect, tooltip);
if (GUI.Button(buttonrect, icon, style))
{
if (fullness < 0.1f
|| !pawn.IsColonistPlayerControlled
|| pawn.Downed) SoundDefOf.ClickReject.PlayOneShotOnCamera();
else
{
if (fullness < 0.1f
|| !pawn.IsColonistPlayerControlled
|| pawn.Downed) SoundDefOf.ClickReject.PlayOneShotOnCamera();
else
{
SoundDefOf.Click.PlayOneShotOnCamera();
pawn.jobs.TryTakeOrderedJob(new Verse.AI.Job(milkjob, pawn));
}
SoundDefOf.Click.PlayOneShotOnCamera();
pawn.jobs.TryTakeOrderedJob(new Verse.AI.Job(milkjob, pawn));
}
Widgets.DrawHighlightIfMouseover(buttonrect);
}
Widgets.DrawHighlightIfMouseover(buttonrect);
}
@ -452,20 +441,7 @@ namespace RJW_Menstruation
public static bool ShouldShowWombGizmo(this Pawn pawn)
{
if (Configurations.EnableWombIcon)
{
if (!pawn.IsAnimal())
{
return true;
}
else if (Configurations.EnableAnimalCycle)
{
return true;
}
}
return false;
return Configurations.EnableWombIcon && (!pawn.IsAnimal() || Configurations.EnableAnimalCycle);
}
}
}

View file

@ -55,12 +55,10 @@ namespace RJW_Menstruation
{
get
{
if (allraces == null)
{
List<ThingDef> allThings = DefDatabase<ThingDef>.AllDefsListForReading;
allraces = allThings.FindAll(x => x.race != null && x.race.IsFlesh);
}
if (allraces != null) return allraces;
List<ThingDef> allThings = DefDatabase<ThingDef>.AllDefsListForReading;
allraces = allThings.FindAll(x => x.race != null && x.race.IsFlesh);
return allraces;
}
}
@ -68,29 +66,19 @@ namespace RJW_Menstruation
{
get
{
if (allkinds == null)
{
List<PawnKindDef> allKinds = DefDatabase<PawnKindDef>.AllDefsListForReading;
allkinds = allKinds.FindAll(x => x.race != null);
}
if (allkinds != null) return allkinds;
List<PawnKindDef> allKinds = DefDatabase<PawnKindDef>.AllDefsListForReading;
allkinds = allKinds.FindAll(x => x.race != null);
return allkinds;
}
}
// Defs from Milkable Colonists
public static readonly HediffDef Hediff_Lactating_Drug = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Drug");
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");
}
}