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,8 +61,7 @@ namespace RJW_Menstruation
{
get
{
if (DNAcache == null)
{
if (DNAcache != null) return DNAcache;
try
{
DNAcache = pawn.def.GetModExtension<PawnDNAModExtension>();
@ -77,8 +76,6 @@ namespace RJW_Menstruation
}
return DNAcache;
}
else return DNAcache;
}
}
protected PawnDNAModExtension DNAcache = null;
public ThingDef FilthDef
@ -225,8 +222,8 @@ 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++)
@ -234,14 +231,11 @@ namespace RJW_Menstruation
doers[i].DoIngestionOutcome(pawn, CumThing);
}
}
}
protected void CutMinor()
{
if (volume < 0.01f) volume = 0f;
}
}
public class CumMixture : Cum, IDisposable
@ -288,10 +282,5 @@ namespace RJW_Menstruation
}
return res;
}
}
}

View file

@ -94,8 +94,7 @@ namespace RJW_Menstruation
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)
{
if (m.def == VariousDefOf.HaterCameInsideF) m.moodPowerFactor = 0.5f;
@ -106,9 +105,4 @@ namespace RJW_Menstruation
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 (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);
}
else yield return Translations.Info_noCum;
}
}
public Color GetCumMixtureColor
@ -215,8 +215,8 @@ namespace RJW_Menstruation
{
Color mixedcolor = Color.white;
if (!cums.NullOrEmpty())
{
if (cums.NullOrEmpty()) return mixedcolor;
float mixedsofar = 0;
foreach (Cum cum in cums)
{
@ -226,7 +226,6 @@ namespace RJW_Menstruation
mixedsofar += cum.Volume;
}
}
}
return mixedcolor;
}
}
@ -344,9 +343,9 @@ namespace RJW_Menstruation
{
get
{
if (eggs.NullOrEmpty()) return "";
string res = "";
if (!eggs.NullOrEmpty())
{
int fertilized = 0;
foreach (Egg egg in eggs)
{
@ -362,7 +361,6 @@ namespace RJW_Menstruation
{
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 (!cums.NullOrEmpty()) foreach (Cum cum in cums)
if (eggs.NullOrEmpty() || cums.NullOrEmpty()) return false;
foreach (Cum cum in cums)
{
if (cum.FertVolume > 0) return true;
}
return false;
}
else return false;
}
}
/// <summary>
@ -867,8 +861,7 @@ namespace RJW_Menstruation
/// <returns></returns>
protected void FertilizationCheck()
{
if (!eggs.NullOrEmpty())
{
if (eggs.NullOrEmpty()) return;
foreach (Egg egg in eggs)
{
if (!egg.fertilized) egg.fertilizer = Fertilize();
@ -878,14 +871,20 @@ namespace RJW_Menstruation
}
}
}
}
public void Initialize()
{
Props = (CompProperties_Menstruation)props;
if (!Props.infertile)
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)
@ -933,13 +932,6 @@ namespace RJW_Menstruation
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 (cums == null) cums = new List<Cum>();
curStage = Stage.None;
HugsLibController.Instance.TickDelayScheduler.ScheduleCallback(PeriodSimulator(curStage), GetNextUpdate(), parent.pawn, false);
}
//Log.Message(parent.pawn.Label + " - Initialized menstruation comp");
loaded = true;
}
@ -1120,8 +1112,8 @@ 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)
@ -1196,9 +1188,7 @@ namespace RJW_Menstruation
}
deadeggs.Clear();
}
if (pregnant) return true;
}
return false;
return pregnant;
}
protected void BleedOut()
@ -1229,12 +1219,19 @@ namespace RJW_Menstruation
protected float AbsorbCum(float amount, Absorber absorber)
{
if (absorber != null)
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.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))
{
@ -1242,19 +1239,6 @@ namespace RJW_Menstruation
//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 (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort);
return amount;
}
return 0;
}
@ -1545,8 +1529,8 @@ namespace RJW_Menstruation
protected virtual void ThoughtCumInside(Pawn cummer)
{
if (xxx.is_human(parent.pawn) && xxx.is_human(cummer))
{
if (!xxx.is_human(parent.pawn) || !xxx.is_human(cummer)) return;
if ((cummer.Has(Quirk.Teratophile) != (parent.pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) ||
cummer.Has(Quirk.ImpregnationFetish) ||
cummer.Has(Quirk.Breeder))
@ -1596,7 +1580,6 @@ namespace RJW_Menstruation
}
}
}
}
@ -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,8 +238,8 @@ 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();
@ -264,11 +264,6 @@ namespace RJW_Menstruation
return ContentFinder<Texture2D>.Get((icon), true);
}
else
{
return ContentFinder<Texture2D>.Get(("Genitals/Anal00"), true);
}
}
public static float GestationHours(this Hediff_BasePregnancy hediff)
{

View file

@ -17,10 +17,12 @@ namespace RJW_Menstruation
protected void PregnancyThought()
{
if (!is_discovered && xxx.is_human(pawn))
{
if (!pawn.Has(Quirk.Breeder) && pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) || x.def.Equals(PawnRelationDefOf.Fiance)) == null)
{
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)
{
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
@ -31,9 +33,6 @@ namespace RJW_Menstruation
}
}
}
}
public override void GiveBirth()
{
@ -67,9 +66,11 @@ 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)
@ -82,8 +83,6 @@ namespace RJW_Menstruation
res += " " + Translations.Dialog_WombInfo02;
return res;
}
return "Null";
}
public string GetFatherInfo()
{
@ -295,8 +294,8 @@ 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)
{
baby.training.Train(TrainableDefOf.Obedience, mother);
@ -306,7 +305,6 @@ namespace RJW_Menstruation
baby.training.Train(TrainableDefOf.Tameness, mother);
}
}
}
public bool AddNewBaby(Pawn mother, Pawn father)
@ -421,18 +419,18 @@ 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)
{
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)
{
if (father.gender != Gender.Female) baby.SetFather(father);
else
{
baby.relations.AddDirectRelation(PawnRelationDefOf.Parent, father);
}
else baby.relations.AddDirectRelation(PawnRelationDefOf.Parent, father);
}
}
if (xxx.is_human(baby))
@ -443,8 +441,6 @@ namespace RJW_Menstruation
UpdateTraits(baby, parentTraits);
Rand.PopState();
}
}
else Log.Error("Baby not generated. Request: " + request.ToString());
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,9 +86,12 @@ 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))
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;
@ -96,9 +99,6 @@ namespace RJW_Menstruation
else comp.CumIn(pawn, pawn.GetCumVolume(), pawn.health.capacities.GetLevel(xxx.reproduction));
return false;
}
ModLog.Message("used original rjw method: Comp missing");
return true;
}
}
[HarmonyPatch(typeof(Hediff_BasePregnancy), nameof(Hediff_BasePregnancy.PostBirth))]

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)
@ -75,13 +72,7 @@ namespace RJW_Menstruation
#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,8 +38,7 @@ 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())
{
@ -53,7 +46,6 @@ namespace RJW_Menstruation
}
Configurations.HybridOverride.Add(new HybridInformations(def));
Configurations.HybridOverride.SortBy(x => x.GetDef?.label ?? "Undefined");
}
}
@ -279,7 +271,8 @@ namespace RJW_Menstruation
protected void BuildRaceList()
{
raceList.Clear();
if (!VariousDefOf.AllRaces.NullOrEmpty())
if (VariousDefOf.AllRaces.NullOrEmpty()) return;
foreach (ThingDef def in VariousDefOf.AllRaces)
{
if (def.race != null)

View file

@ -97,14 +97,11 @@ 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)
{
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)
{
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,8 +291,7 @@ namespace RJW_Menstruation
milkcomp = pawn.GetComp<CompMilkable>();
}
if (milkcomp != null)
{
if (milkcomp == null) return;
if (milkcomp is CompMilkable milkable)
{
bool active = (bool)milkcomp.GetPropertyValue("Active");
@ -324,14 +315,13 @@ namespace RJW_Menstruation
}
}
}
}
public static void DrawMilkBottle(Rect rect, Pawn pawn, JobDef milkjob,float fullness)
{
Texture2D texture;
Rect buttonrect = new Rect(rect.x, rect.y, rect.height, rect.height);
if (fullness > 0.0f)
{
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);
@ -354,7 +344,6 @@ namespace RJW_Menstruation
}
Widgets.DrawHighlightIfMouseover(buttonrect);
}
}
public static string GetVaginaLabel(this Pawn pawn)
@ -452,20 +441,7 @@ namespace RJW_Menstruation
public static bool ShouldShowWombGizmo(this Pawn pawn)
{
if (Configurations.EnableWombIcon)
{
if (!pawn.IsAnimal())
{
return true;
return Configurations.EnableWombIcon && (!pawn.IsAnimal() || Configurations.EnableAnimalCycle);
}
else if (Configurations.EnableAnimalCycle)
{
return true;
}
}
return false;
}
}
}

View file

@ -55,12 +55,10 @@ namespace RJW_Menstruation
{
get
{
if (allraces == null)
{
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)
{
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");
}
}